@@ -28,21 +28,21 @@ will not cause the L<die> to be called under normal use, because
28
28
L < pull-one > will never be called after it returns C < IterationEnd > :
29
29
30
30
= begin code :skip-test
31
- my $seq = Seq.new: class :: does Iterator {
32
- method pull-one {
33
- state $x = 2;
34
- $x or die "You're under arrest for violation of Iterator protocol!";
35
- --$x ?? $x !! IterationEnd
36
- }
37
- }.new;
38
- .pull-one.say xx 10 with $seq.iterator;
39
-
40
- # 1
41
- #
42
- # You're under arrest for violation of Iterator protocol!
43
- # in method pull-one at foo.p6 line 4
44
- # in block at foo.p6 line 8
45
- # in block <unit> at foo.p6 line 8
31
+ my $seq = Seq.new: class :: does Iterator {
32
+ method pull-one {
33
+ state $x = 2;
34
+ $x or die "You're under arrest for violation of Iterator protocol!";
35
+ --$x ?? $x !! IterationEnd
36
+ }
37
+ }.new;
38
+ .pull-one.say xx 10 with $seq.iterator;
39
+
40
+ # 1
41
+ #
42
+ # You're under arrest for violation of Iterator protocol!
43
+ # in method pull-one at foo.p6 line 4
44
+ # in block at foo.p6 line 8
45
+ # in block <unit> at foo.p6 line 8
46
46
= end code
47
47
48
48
The only valid use of the sentinel value C < IterationEnd > in a program
@@ -84,7 +84,7 @@ C<$count>.
84
84
85
85
my @array;
86
86
say (1 .. Inf).iterator.push-exactly(@array, 3); # OUTPUT: «3»
87
- say @array; # [1 2 3]
87
+ say @array; # OUTPUT: « [1 2 3]»
88
88
89
89
= head2 method push-at-least
90
90
@@ -105,7 +105,7 @@ produce more elements to achieve better performance.
105
105
106
106
my @array;
107
107
say (1 .. Inf).iterator.push-at-least(@array, 10); # OUTPUT: «10»
108
- say @array; # [1 2 3 4 5 6 7 8 9 10]
108
+ say @array; # OUTPUT: « [1 2 3 4 5 6 7 8 9 10]»
109
109
110
110
= head2 method push-all
111
111
0 commit comments