Skip to content

Commit b1325f2

Browse files
committed
Updates Seq
Initially addressing #3808, but now also #3855
1 parent cfde583 commit b1325f2

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

doc/Type/Seq.pod6

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ argument. Creates an empty C<Seq> if called with no argument.
9797
9898
=head2 method iterator
9999
100-
method iterator(Seq:D: --> Iterator:D)
100+
method iterator(Seq:D:)
101101
102102
If the C<Seq> is not cached, returns the underlying iterator and marks
103103
the invocant as consumed. If called on an already consumed sequence,
@@ -107,12 +107,21 @@ Otherwise returns an iterator over the cached list.
107107
108108
=head2 method is-lazy
109109
110-
method is-lazy(Seq:D: --> Bool:D)
110+
method is-lazy(Seq:D:)
111111
112112
Returns C<True> if and only if the underlying iterator or cached list
113113
considers itself lazy. If called on an already consumed sequence, throws
114114
an error of type L<X::Seq::Consumed|/type/X::Seq::Consumed>.
115115
116+
=head2 method Seq
117+
118+
Defined as
119+
120+
multi method Seq(Seq:D:)
121+
122+
Clones the object.
123+
124+
116125
=head2 method Capture
117126
118127
Defined as
@@ -134,24 +143,25 @@ L<fails|/routine/fail> with L<X::Cannot::Lazy|/type/X::Cannot::Lazy>.
134143
135144
=head2 method from-loop
136145
137-
multi method from-loop(&body --> Seq:D)
138-
multi method from-loop(&body, &cond, :$repeat --> Seq:D)
139-
multi method from-loop(&body, &cond, &afterward --> Seq:D)
146+
multi method from-loop(&body, :$label)
147+
multi method from-loop(&body, &cond, :$repeat!, :$label)
148+
multi method from-loop(&body, &cond, :$label)
149+
multi method from-loop(&body, &cond, &afterwards, :$label)
140150
141151
These methods create new C<Seq>-based callbacks.
142152
143-
The first form produces an infinite C<Seq> by calling C<&body> each time a new
153+
In general, it produces an infinite C<Seq> by calling C<&body> each time a new
144154
element is requested, using the return value from C<&body> as the item. This
145155
emulates (or implements) a C<loop { body }> construct.
146156
147-
The second form calls C<&cond> before each call to C<&body>, and terminates
157+
When the multi includes C<&cond>, it's invoked before each call to
158+
C<&body>, and terminates
148159
the sequence if C<&cond> returns a false value. If C<$repeat> is set to a true
149160
value, the first call to C<&cond> is omitted, and C<&body> called right away.
150161
This emulates (or implements) C<while cond { body }> and
151162
C<repeat { body } while cond> loops.
152163
153-
The third form enables C-style looping by calling a third callback,
154-
C<&afterward>, after each call to C<&body>.
164+
If present, C<&afterward> will be called after each call to C<&body>.
155165
156166
=head2 method sink
157167

0 commit comments

Comments
 (0)