Skip to content

Commit e71d63b

Browse files
authored
Merge pull request #2902 from chloekek/infix-z-clarify
Clarify infix Z behavior
2 parents 1b4ecc2 + b2fda75 commit e71d63b

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

doc/Language/operators.pod6

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2780,14 +2780,16 @@ other positions, it's a syntax error.
27802780
27812781
sub infix:<Z>(**@lists --> Seq:D) is assoc<chain>
27822782
2783-
The X<Zip operator> interleaves the lists passed to C<Z> like a zipper, stopping
2784-
as soon as the first input list is exhausted. The returned C<Seq> contains a
2785-
nested list with values for all C<Z> operators in a chain.
2783+
The X<Zip operator> interleaves the lists passed to C<Z> like a zipper,
2784+
taking index-corresponding elements from each operand. The returned C<Seq>
2785+
contains nested lists, each with a value from every operand in the chain. If
2786+
one of the operands runs out of elements prematurely, the zip operator will
2787+
stop.
27862788
27872789
=for code
27882790
say (1, 2 Z <a b c> Z <+ ->).perl;
27892791
# OUTPUT: «((1, "a", "+"), (2, "b", "-")).Seq␤»
2790-
for <a b c> Z <1 2 3> -> [$l, $r] {
2792+
for <a b c> Z <1 2 3 4> -> [$l, $r] {
27912793
say "$l:$r"
27922794
}
27932795
# OUTPUT: «a:1␤b:2␤c:3␤»

0 commit comments

Comments
 (0)