@@ -151,7 +151,7 @@ Non-matching characters can simply replace the original slashes. Matching
151
151
characters, like braces, require an extra step where you use an
152
152
assignment operator to assign the replacement to the match part.
153
153
154
- = head2 Assignment Operators
154
+ = head1 Assignment Operators
155
155
156
156
Infix operators can be combined with the assignment operator to modify a
157
157
value and apply the result to a container in one go. Containers will be
@@ -178,7 +178,7 @@ Although not strictly operators, methods can be used in the same fashion.
178
178
my $a = 3.14;
179
179
$a .= Int; # 3
180
180
181
- = head2 Negated Relational Operators
181
+ = head1 Negated Relational Operators
182
182
183
183
The result of a relational operator returning C < Bool > can be negated by
184
184
prefixing with C < ! > . To avoid visual confusion with the C < !! > operator,
@@ -194,15 +194,15 @@ There are shortcuts for C<!==> and C<!eq>, namely C<!=> and C<ne>.
194
194
my $today = Date.today;
195
195
say so $release !before $today; # True
196
196
197
- = head2 Reversed Operators
197
+ = head1 Reversed Operators
198
198
199
199
Any infix operator may be called with its two arguments reversed by prefixing
200
200
with C < R > . Associativity of operands is reversed as well.
201
201
202
202
say 4 R/ 12; # 3
203
203
say [R/] 2, 4, 16; # 2
204
204
205
- = head2 Hyper Operators
205
+ = head1 Hyper Operators
206
206
207
207
Hyper operators apply a given operator enclosed by C < « > and C < » > to one or two
208
208
lists, returning the resulting list. The pointy part of C < « > or C < » > has to
@@ -292,7 +292,7 @@ to destructure a List of Lists.
292
292
my $p = (2,3);
293
293
say $neighbors »>>+<<» ($p, *); # ((1 3) (2 2) (2 4) (3 3))
294
294
295
- = head2 Reduction Operators
295
+ = head1 Reduction Operators
296
296
297
297
Reduction operators apply any infix operator, surrounded by C < [ > and C < ] > ,
298
298
element by element and return the resulting value.
@@ -319,7 +319,7 @@ quote it with C<[]> (e.g. C<[\[\x]]>).
319
319
my $lazy := [\+] 1..*;
320
320
say $lazy[^10]; # (1 3 6 10 15 21 28 36 45 55)
321
321
322
- = head2 Cross Operators
322
+ = head1 Cross Operators
323
323
324
324
The cross metaoperator, C < X > , will apply a given infix operator in order of
325
325
cross product to all lists, such that the rightmost operator varies most
@@ -328,7 +328,7 @@ quickly.
328
328
1..3 X~ <a b>
329
329
# produces <1a, 1b, 2a, 2b, 3a, 3b>
330
330
331
- = head2 Zip Operators
331
+ = head1 Zip Operators
332
332
333
333
The zip metaoperator, C < Z > , will apply a given infix operator to pairs taken
334
334
one left, one right, from its arguments. The resulting list is returned.
@@ -342,14 +342,14 @@ element of C<*> will repeat its 2nd last element indefinitely.
342
342
my @l = <a b c d> Z~ ':' xx *; # <a: b: c: d:>
343
343
my @l = <a b c d> Z~ 1, 2, *; # <a1 b2 c2 d2>
344
344
345
- = head2 Sequential Operators
345
+ = head1 Sequential Operators
346
346
347
347
The sequential metaoperator, C < S > , will suppress any concurrency, or reordering
348
348
done by the optimizer. Most simple infix operators are supported.
349
349
350
350
say so 1 S& 2 S& 3; # True
351
351
352
- = head2 Nesting of Meta Operators
352
+ = head1 Nesting of Meta Operators
353
353
354
354
To avoid ambiguity when chaining meta operators use square brackets to help the
355
355
compiler to understand you.
0 commit comments