Documentation for method iterator
assembled from the following pages:
Class: Any §
From Any
(Any) method iterator §
Defined as:
multi method iterator(Any:)
Returns the object as an iterator after converting it to a list. This is the function called from the for
statement.
.say for 3; # OUTPUT: «3»
Most subclasses redefine this method for optimization, so it's mostly types that do not actually iterate the ones that actually use this implementation.
Role: Iterable §
From Iterable
(Iterable) method iterator §
Defined as:
method iterator(--> Iterator)
Method stub that ensures all classes doing the Iterable
role have a method iterator
.
It is supposed to return an Iterator.
say (1..10).iterator;
Class: Mu §
From Mu
(Mu) method iterator §
Defined as:
method iterator(--> Iterator)
Coerces the invocant to a list
by applying its .list
method and uses iterator
on it.
my = Mu.iterator;say .pull-one; # OUTPUT: «(Mu)» say .pull-one; # OUTPUT: «IterationEnd»
Class: Seq §
From Seq
(Seq) method iterator §
method iterator(Seq:)
If the Seq
is not cached, returns the underlying iterator and marks the invocant as consumed. If called on an already consumed sequence, throws an error of type X::Seq::Consumed.
Otherwise returns an iterator over the cached list.
Role: PositionalBindFailover §
(PositionalBindFailover) method iterator §
method iterator(PositionalBindFailover:)
This method stub ensure that a class implementing role PositionalBindFailover
provides an iterator
method.
Class: Junction §
From Junction
(Junction) method iterator §
Defined as:
multi method iterator(Junction:)
Returns an iterator over the Junction
converted to a List
.
Class: HyperSeq §
From HyperSeq
(HyperSeq) method iterator §
method iterator(HyperSeq: --> Iterator)
Returns the underlying iterator.
Class: RaceSeq §
From RaceSeq
(RaceSeq) method iterator §
method iterator(RaceSeq: --> Iterator)
Returns the underlying iterator.