So I was scratching my head about iterators, and I don't see why
something like the following would not work.

An iterator is a structure or capsule having methods value(), next(),
and hasNext().  value() returns the value at the current "position".
next() returns an iterator over the "rest" of the collection.
hasNext() tests for termination.

Given a construct like this, "forall" is simply a procedure that
applies a function to all values:

   forall: (fn (by-ref (Iterator 'a)) (fn 'a -> ()) -> ())

I'ld have to scratch my head a second about "fold", but I'm sure it's
comparably straightforward. The main issue here is to ensure that
appropriate inlining happens so that the higher-order nature of the
construct gets compiled out appropriately.

shap
_______________________________________________
bitc-dev mailing list
[email protected]
http://www.coyotos.org/mailman/listinfo/bitc-dev

Reply via email to