@@ -4555,9 +4555,7 @@ the separate C<.defined> method is always there if you need it.
4555
4555
4556
4556
=head1 Lists
4557
4557
4558
- =over 4
4559
-
4560
- =item *
4558
+ =head2 Lazy flattening
4561
4559
4562
4560
List context in Perl 6 is by default lazy. This means a list can
4563
4561
contain infinite generators without blowing up. No flattening happens
@@ -4566,7 +4564,7 @@ method at call time (and maybe not even then). We say that such
4566
4564
an argument list is "lazily flattened", meaning that we promise to
4567
4565
flatten the list on demand, but not before.
4568
4566
4569
- =item *
4567
+ =head2 C<list>, C<flat>, C< item>, and C<.tree>
4570
4568
4571
4569
There is a "C<list>" operator which imposes a list context on
4572
4570
its arguments even if C<list> itself occurs in a item context.
@@ -4601,14 +4599,14 @@ mutable array, use explicit square brackets around the list.)
4601
4599
4602
4600
To force a non-flattening item context, use the "C<item>" operator.
4603
4601
4604
- =item *
4602
+ =head2 Forcing capture context
4605
4603
4606
4604
The C<|> prefix operator may be used to force "capture" context on its
4607
4605
argument and I<also> defeat any scalar argument checking imposed by
4608
4606
subroutine signature declarations. Any resulting list arguments are
4609
4607
then evaluated lazily.
4610
4608
4611
- =item *
4609
+ =head2 The C<eager> operator
4612
4610
4613
4611
To force non-lazy list processing, use the C<eager> list operator.
4614
4612
List assignment is also implicitly eager. (Actually, when we say
@@ -4629,7 +4627,7 @@ in the array will also force eager completion.)
4629
4627
This operator is agnostic towards flattening or slicing. In merely changes
4630
4628
the work-ahead policy for the value generator.
4631
4629
4632
- =item *
4630
+ =head2 The C<hyper> operator
4633
4631
4634
4632
A variant of C<eager> is the C<hyper> list operator, which declares
4635
4633
not only that you want all the values generated now, but that you want
@@ -4644,7 +4642,7 @@ the hyper is done. Thinking about Map-Reduce algorithms here...)
4644
4642
This operator is agnostic towards flattening or slicing. It merely changes
4645
4643
the work-ahead policy for the value generator.
4646
4644
4647
- =item *
4645
+ =head2 Signature checking
4648
4646
4649
4647
Signatures on non-multi subs can be checked at compile time, whereas
4650
4648
multi sub and method call signatures can only be checked at run time
@@ -4660,20 +4658,20 @@ know which signature to check against. Such return values are
4660
4658
bundled up into a "parcel" for later delivery to a context that
4661
4659
will determine its context lazily.
4662
4660
4663
- =item *
4661
+ =head2 The C<< => >> operator
4664
4662
4665
4663
The C<< => >> operator now constructs C<Pair> objects rather than merely
4666
4664
functioning as a comma. Both sides are in item context.
4667
4665
4668
- =item *
4666
+ =head2 The C<< .. >> operator
4669
4667
X<..>
4670
4668
4671
4669
The C<< .. >> operator now constructs a C<Range> object rather than merely
4672
4670
functioning as an operator. Both sides are in item context. Semantically,
4673
4671
the C<Range> acts like a list of its values to the extent possible, but
4674
4672
does so lazily, unlike Perl 5's eager range operator.
4675
4673
4676
- =item *
4674
+ =head2 Hash assignment
4677
4675
4678
4676
There is no such thing as a hash list context. Assignment to a hash
4679
4677
produces an ordinary list context. You may assign alternating keys
@@ -4685,7 +4683,7 @@ in which the key is the inner C<Pair>:
4685
4683
4686
4684
%hash = (($keykey => $keyval) => $value);
4687
4685
4688
- =item *
4686
+ =head2 The anonymous C<enum> function
4689
4687
4690
4688
The anonymous C<enum> function takes a list of keys or pairs, and adds
4691
4689
values to any keys that are not already part of a key. The value added
@@ -4700,15 +4698,13 @@ are the same as:
4700
4698
%hash = ();
4701
4699
%hash<Mon Tue Wed Thu Fri Sat Sun> = 1..7;
4702
4700
4703
- =item *
4701
+ =head2 Hash binding
4704
4702
4705
4703
In contrast to assignment, binding to a hash requires a C<Hash> (or
4706
4704
C<Pair>) object. Binding to a "splat" hash requires a list of pairs
4707
4705
or hashes, and stops processing the argument list when it runs out
4708
4706
of pairs or hashes. See S06 for much more about parameter binding.
4709
4707
4710
- =back
4711
-
4712
4708
=head1 Files
4713
4709
4714
4710
=over 4
0 commit comments