@@ -765,22 +765,22 @@ C<take> is operating. These need not be identical contexts, since they
765
765
may bind or coerce the resulting parcels differently:
766
766
767
767
my @y;
768
- @x = gather for 1..2 { # flat context for list of parcels
769
- my ($y) := take $_, $_ * 10; # item context promotes parcel to seq
768
+ my @x = gather for 1..2 { # flat context for list of parcels
769
+ my ($y) := \( take $_, $_ * 10) ; # binding forces item context
770
770
push @y, $y;
771
771
}
772
- # @x contains 4 Ints: 1,10,2,20 flattened by list assignment to @x
773
- # @y contains 2 Seqs: Seq (1,10),Seq (2,20) sliced by binding to positional $y
772
+ # @x contains 4 Ints: 1,10,2,20 flattened by list assignment to @x
773
+ # @y contains 2 Parcels: $ (1,10),$ (2,20) sliced by binding to positional $y
774
774
775
775
Likewise, we can just remember the gather's result parcel by binding and
776
776
later coercing it:
777
777
778
- my |$c := gather for 1..2 {
778
+ my ($c) := \( gather for 1..2 {
779
779
take $_, $_ * 10;
780
- }
780
+ });
781
781
# $c.flat produces 1,10,2,20 -- flatten fully into a list of Ints.
782
- # $c.lol produces Seq( 1,10),Seq (2,20) -- list of Seqs , a 2-D list.
783
- # $c.item produces Seq( (1,10),(2,20)) -- coerced to Seq of unresolved Parcels
782
+ # $c.lol produces Lol.new($( 1,10),$ (2,20)) -- list of Parcels , a 2-D list.
783
+ # $c.item produces ($ (1,10),$ (2,20)).list.item -- a list of Parcels, as an item.
784
784
785
785
Note that the C<take> itself is in sink context in this example because
786
786
the C<for> loop is in the sink context provided inside the gather.
0 commit comments