Skip to content

Commit fedd761

Browse files
committed
more headings for S02, under Lists
1 parent a69cc7b commit fedd761

File tree

1 file changed

+11
-15
lines changed

1 file changed

+11
-15
lines changed

S02-bits.pod

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4555,9 +4555,7 @@ the separate C<.defined> method is always there if you need it.
45554555

45564556
=head1 Lists
45574557

4558-
=over 4
4559-
4560-
=item *
4558+
=head2 Lazy flattening
45614559

45624560
List context in Perl 6 is by default lazy. This means a list can
45634561
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
45664564
an argument list is "lazily flattened", meaning that we promise to
45674565
flatten the list on demand, but not before.
45684566

4569-
=item *
4567+
=head2 C<list>, C<flat>, C<item>, and C<.tree>
45704568

45714569
There is a "C<list>" operator which imposes a list context on
45724570
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.)
46014599

46024600
To force a non-flattening item context, use the "C<item>" operator.
46034601

4604-
=item *
4602+
=head2 Forcing capture context
46054603

46064604
The C<|> prefix operator may be used to force "capture" context on its
46074605
argument and I<also> defeat any scalar argument checking imposed by
46084606
subroutine signature declarations. Any resulting list arguments are
46094607
then evaluated lazily.
46104608

4611-
=item *
4609+
=head2 The C<eager> operator
46124610

46134611
To force non-lazy list processing, use the C<eager> list operator.
46144612
List assignment is also implicitly eager. (Actually, when we say
@@ -4629,7 +4627,7 @@ in the array will also force eager completion.)
46294627
This operator is agnostic towards flattening or slicing. In merely changes
46304628
the work-ahead policy for the value generator.
46314629

4632-
=item *
4630+
=head2 The C<hyper> operator
46334631

46344632
A variant of C<eager> is the C<hyper> list operator, which declares
46354633
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...)
46444642
This operator is agnostic towards flattening or slicing. It merely changes
46454643
the work-ahead policy for the value generator.
46464644

4647-
=item *
4645+
=head2 Signature checking
46484646

46494647
Signatures on non-multi subs can be checked at compile time, whereas
46504648
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
46604658
bundled up into a "parcel" for later delivery to a context that
46614659
will determine its context lazily.
46624660

4663-
=item *
4661+
=head2 The C<< => >> operator
46644662

46654663
The C<< => >> operator now constructs C<Pair> objects rather than merely
46664664
functioning as a comma. Both sides are in item context.
46674665

4668-
=item *
4666+
=head2 The C<< .. >> operator
46694667
X<..>
46704668

46714669
The C<< .. >> operator now constructs a C<Range> object rather than merely
46724670
functioning as an operator. Both sides are in item context. Semantically,
46734671
the C<Range> acts like a list of its values to the extent possible, but
46744672
does so lazily, unlike Perl 5's eager range operator.
46754673

4676-
=item *
4674+
=head2 Hash assignment
46774675

46784676
There is no such thing as a hash list context. Assignment to a hash
46794677
produces an ordinary list context. You may assign alternating keys
@@ -4685,7 +4683,7 @@ in which the key is the inner C<Pair>:
46854683

46864684
%hash = (($keykey => $keyval) => $value);
46874685

4688-
=item *
4686+
=head2 The anonymous C<enum> function
46894687

46904688
The anonymous C<enum> function takes a list of keys or pairs, and adds
46914689
values to any keys that are not already part of a key. The value added
@@ -4700,15 +4698,13 @@ are the same as:
47004698
%hash = ();
47014699
%hash<Mon Tue Wed Thu Fri Sat Sun> = 1..7;
47024700

4703-
=item *
4701+
=head2 Hash binding
47044702

47054703
In contrast to assignment, binding to a hash requires a C<Hash> (or
47064704
C<Pair>) object. Binding to a "splat" hash requires a list of pairs
47074705
or hashes, and stops processing the argument list when it runs out
47084706
of pairs or hashes. See S06 for much more about parameter binding.
47094707

4710-
=back
4711-
47124708
=head1 Files
47134709

47144710
=over 4

0 commit comments

Comments
 (0)