On Thu, Aug 19, 2004 at 05:26:38PM -0400, John Macdonald wrote:
: In scalar context a non-destructive read of an iterator might
: be called $iter.peek and the next .read will get (and remove)
: the same value that .peek returns.  Implementation would be
: fairly simple - the control info for an iterator would have a
: field containing the next value and a flag to specify whether
: that value had been determined yet.

Indeed, the Perl 6 argument-passing/parameter-binding mechanism is
based on the notion that a list is composed of the part it knows about
already and the part it may have to generate on the fly.  Arrays and
iterators can share this characteristic.  But arrays are inclined to
remember their past values while iterators are inclined to forget.

Larry

Reply via email to