Skip to content

Commit 9d180cf

Browse files
committed
mention the sequence operator
while here document the various way to build a Seq at the start of the document.
1 parent 2ff7fb6 commit 9d180cf

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

doc/Type/Seq.pod6

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,19 @@ C<Seq> is born in a state where iterating it will consume the values.
1111
Calling C<.cache> on a C<Seq> will make it store the generated values
1212
for later access.
1313
14+
A high-level construct to generate a C<Seq> is L«C<gather/take>|/syntax/gather%20take»,
15+
as well as many built-in methods like L«C<map>|/routine/map» and
16+
L«C<grep>|/routine/grep», low-level constructors to create a
17+
C<Seq> from an iterator or from looping constructs are available too.
18+
19+
A C<Seq> can also be constructed with the
20+
L«sequence operator C<...>|/language/operators#infix_...» or one of its
21+
variants.
22+
23+
my $s = (1...5);
24+
say $s; # OUTPUT: «1 2 3 4 5)␤»
25+
say $s.^name; # OUTPUT: «Seq␤»
26+
1427
Assigning the values of a C<Seq> to an array consumes a C<Seq> that is
1528
not lazy. Use the C<lazy> statement prefix to avoid a C<Seq> from being
1629
iterated during the assignment:
@@ -49,9 +62,6 @@ it couldn't throw away old values), so this dies:
4962
# (you might solve this by adding .cache on usages of the Seq, or
5063
# by assigning the Seq into an array)»
5164
52-
A high-level construct to generate a C<Seq> is C<gather/take>, as well as many
53-
built-in methods like C<map> and C<grep>, low-level constructors to create a
54-
C<Seq> from an iterator or from looping constructs are available too.
5565
5666
B<Caution:> No program should ever assume a C<Seq> may only be iterated once
5767
even if not cached by the program. Caching is a volatile state exposed to the

0 commit comments

Comments
 (0)