class Iterator
src
class Iterator is Iterable { }
A Iterator is an object that can generate or provide elements of a
sequence. Users usually don't have to care about iterators, their usage
is hidden behind iteration APIs such as for @list { } , L<map>, L<grep>
and list indexing with .[$idx] .
Iterators provide an immutable view of a sequence, though the actual elements
in the sequence can still be mutable.
Methods
reify
method reify(Iterator:D: $n) returns Parcel:D
Returns at least $n elements of the sequence, followed by additional
iterators needed to generate the remaining elements.
Subsequent calls to reify on the same object must return the same
L<Parcel>, even if $n changed between the calls.
infinite
method infinite(Iterator:D:)
Returns True if the sequence being iterated is known to be infinite,
False if it is known to be finite, and Mu if the iterator does not know
if the sequence is finite or infinite.