Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Some reflow and rephrasing
  • Loading branch information
JJ committed Jul 3, 2018
1 parent b4dda29 commit 8e9251b
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions doc/Language/list.pod6
Expand Up @@ -232,13 +232,14 @@ value, but unlike the above options, it will break L<Scalars|/type/Scalar>.
=head1 Lazy Lists
X<|lazy (property of List)>
Lists can be lazy, what means that their values are computed on demand and
Lists can be lazy, which means that their values are computed on demand and
stored for later use. To create a lazy list use
L<gather/take|/language/control#gather/take> or the
L<sequence operator|/language/operators#infix_...>. You can also write a class that
L<gather/take|/language/control#gather/take> or the L<sequence
operator|/language/operators#infix_...>. You can also write a class that
implements the role L<Iterable|/type/Iterable> and returns C<True> on a call to
L<is-lazy|/routine/is-lazy>. Please note that some methods like C<elems> cannot be
called on a lazy List and will result in a thrown L<Exception|/type/Exception>.
L<is-lazy|/routine/is-lazy>. Please note that some methods like C<elems> cannot
be called on a lazy List and will result in a thrown
L<Exception|/type/Exception>.
# This list is lazy and elements will not be available
# until explicitly requested.
Expand All @@ -252,7 +253,8 @@ called on a lazy List and will result in a thrown L<Exception|/type/Exception>.
my @no-longer-lazy = eager @l; # Forcing eager evaluation
say @no-longer-lazy.is-lazy; # OUTPUT: «False␤»
say @no-longer-lazy[]; # OUTPUT: (sequence starting with «[1 11 121» ending with a 300 digit number)
say @no-longer-lazy[];
# OUTPUT: (sequence starting with «[1 11 121» ending with a 300 digit number)
A common use case for lazy Lists are the processing of infinite sequences of numbers,
whose values have not been computed yet and cannot be computed in their entirety.
Expand Down

0 comments on commit 8e9251b

Please sign in to comment.