routine eager
1 | class List |
1.1 | (List) routine eager |
2 | class Any |
2.1 | (Any) method eager |
3 | role Sequence |
3.1 | (Sequence) method eager |
Documentation for routine eager
assembled from the following types:
class List
From List
(List) routine eager
Defined as:
multi method eager(List: --> List)multi sub eager(* --> List)
Evaluates all elements in the List
eagerly, and returns them as a List
.
my \ll = (lazy 1..5).cache;say ll[]; # OUTPUT: «(...)»say ll.eager # OUTPUT: «(1 2 3 4 5)»
class Any
From Any
(Any) method eager
Defined as:
method eager() is nodal
Interprets the invocant as a List, evaluates it eagerly, and returns that List.
my = 1..5;say ; # OUTPUT: «1..5»say .eager; # OUTPUT: «(1 2 3 4 5)»
role Sequence
From Sequence
(Sequence) method eager
method eager(::?CLASS: --> List)
Returns an eagerly evaluated List based on the invocant sequence, and marks it as consumed. If called on an already consumed Seq
, throws an error of type X::Seq::Consumed.
my = lazy 1..5;say .is-lazy; # OUTPUT: «True»say .eager; # OUTPUT: «(1 2 3 4 5)»say .eager;CATCH# OUTPUT: «Throws exception if already consumed»