@@ -116,15 +116,16 @@ L<#prefix ...> etc. stub operators.
116
116
Defining custom operators is covered in
117
117
L < Defining Operators functions|/language/functions#Defining_Operators > .
118
118
119
- = head1 Meta Operators
119
+ = head1 Metaoperators
120
120
121
- Meta operators can be parameterized with other operators or subroutines in the
122
- same way as functions can take functions as parameters. To use a subroutine as
123
- a parameter, prefix its name with a C < & > . Perl 6 will generate the actual
124
- combined operator in the background, allowing the mechanism to be applied to
125
- user defined operators. To disambiguate chained meta operators, enclose the
126
- inner operator in square brackets. There are quite a few Meta operators with
127
- different semantics as explained, next.
121
+ Metaoperators can be parameterized with other operators or subroutines
122
+ in the same way as functions can take functions as parameters. To use a
123
+ subroutine as a parameter, prefix its name with a C < & > . Perl 6 will
124
+ generate the actual combined operator in the background, allowing the
125
+ mechanism to be applied to user defined operators. To disambiguate
126
+ chained metaoperators, enclose the inner operator in square brackets.
127
+ There are quite a few metaoperators with different semantics as
128
+ explained, next.
128
129
129
130
= head1 Substitution Operators
130
131
@@ -251,7 +252,7 @@ Although not strictly operators, methods can be used in the same fashion.
251
252
$a .= round; # RESULT: «3»
252
253
253
254
= head1 Negated Relational Operators
254
- X < |! (negation meta operator ) > X < |!== > X < |!eq >
255
+ X < |! (negation metaoperator ) > X < |!== > X < |!eq >
255
256
256
257
The result of a relational operator returning C < Bool > can be negated by
257
258
prefixing with C < ! > . To avoid visual confusion with the C < !! > operator,
@@ -268,10 +269,10 @@ There are shortcuts for C<!==> and C<!eq>, namely C<!=> and C<ne>.
268
269
say so $release !before $today; # OUTPUT: «False»
269
270
270
271
= head1 Reversed Operators
271
- X < |R,reverse meta operator >
272
+ X < |R,reverse metaoperator >
272
273
273
- Any infix operator may be called with its two arguments reversed by prefixing
274
- with C < R > . Associativity of operands is reversed as well.
274
+ Any infix operator may be called with its two arguments reversed by
275
+ prefixing with C < R > . Associativity of operands is reversed as well.
275
276
276
277
say 4 R/ 12; # OUTPUT: «3»
277
278
say [R/] 2, 4, 16; # OUTPUT: «2»
@@ -290,7 +291,7 @@ list until all elements of the longer list are processed.
290
291
say (1, 2, 3, 4) »~» <a b>; # OUTPUT: «(1a 2b 3a 4b)»
291
292
say (1, 2, 3) »+« (4, 5, 6); # OUTPUT: «(5 7 9)»
292
293
293
- Assignment meta operators can be I < hyped > .
294
+ Assignment metaoperators can be I < hyped > .
294
295
295
296
my @a = 1, 2, 3;
296
297
say @a »+=» 1; # OUTPUT: «[2 3 4]»
@@ -381,7 +382,7 @@ You can chain hyper operators to destructure a List of Lists.
381
382
say $neighbors »>>+<<» ($p, *); # OUTPUT: «((1 3) (2 2) (2 4) (3 3))»
382
383
383
384
= head1 Reduction Operators
384
- X < |[] (reduction meta operators ) > X < |[+] (reduction meta operators ) >
385
+ X < |[] (reduction metaoperators ) > X < |[+] (reduction metaoperators ) >
385
386
386
387
The reduction metaoperator, C < [ ] > , reduces a list with the given infix
387
388
operator. It gives the same result as the L < reduce > routine - see there for
@@ -412,7 +413,7 @@ quote it with C<[]> (e.g. C<[\[\x]]>).
412
413
say @n[^5]; # OUTPUT: «(1 12 123 1234 12345)»
413
414
414
415
= head1 Cross Operators
415
- X < |X (cross meta operator ) >
416
+ X < |X (cross metaoperator ) >
416
417
417
418
The cross metaoperator, C < X > , will apply a given infix operator in order of
418
419
cross product to all lists, such that the rightmost operator varies most
@@ -421,7 +422,7 @@ quickly.
421
422
1..3 X~ <a b> # RESULT: «<1a, 1b, 2a, 2b, 3a, 3b>»
422
423
423
424
= head1 Zip Operators
424
- X < |Z (zip meta operator ) >
425
+ X < |Z (zip metaoperator ) >
425
426
426
427
The zip metaoperator (which is not the same thing as L < Z|#infix_Z > ) will
427
428
apply a given infix operator to pairs taken one left, one right, from its
@@ -441,16 +442,16 @@ If an infix operator is not given, C<,> (comma operator) will be used by default
441
442
my @l = 1 Z 2; # RESULT: «[(1 2)]»
442
443
443
444
= head1 Sequential Operators
444
- X < |S,sequential meta operator >
445
+ X < |S,sequential metaoperator >
445
446
446
447
The sequential metaoperator, C < S > , will suppress any concurrency or reordering
447
448
done by the optimizer. Most simple infix operators are supported.
448
449
449
450
say so 1 S& 2 S& 3; # OUTPUT: «True»
450
451
451
- = head1 Nesting of Meta Operators
452
+ = head1 Nesting of Metaoperators
452
453
453
- To avoid ambiguity when chaining meta operators , use square brackets to help the
454
+ To avoid ambiguity when chaining metaoperators , use square brackets to help the
454
455
compiler understand you.
455
456
456
457
my @a = 1, 2, 3;
@@ -2220,7 +2221,7 @@ values for all C<Z> operators in a chain.
2220
2221
}
2221
2222
# OUTPUT: «a:1b:2c:3»
2222
2223
2223
- The C < Z > operator also exists as a meta operator , in which case the inner
2224
+ The C < Z > operator also exists as a metaoperator , in which case the inner
2224
2225
lists are replaced by the value from applying the operator to the
2225
2226
list:
2226
2227
@@ -2239,9 +2240,8 @@ elements vary most rapidly:X<|cross product operator>
2239
2240
# (2 a 9) (2 b 9) (2 c 9)
2240
2241
# (3 a 9) (3 b 9) (3 c 9))
2241
2242
2242
- The C < X > operator also exists as a meta operator, in which case the inner
2243
- lists are replaced by the value from applying the operator to the
2244
- list:
2243
+ The C < X > operator also exists as a metaoperator, in which case the inner
2244
+ lists are replaced by the value from applying the operator to the list:
2245
2245
2246
2246
1..3 X~ <a b c> X~ 9
2247
2247
# produces (1a9 1b9 1c9 2a9 2b9 2c9 3a9 3b9 3c9)
@@ -2348,8 +2348,9 @@ object.
2348
2348
If type constrains on variables or containers are present a type check will be
2349
2349
performed at runtime. On failure C < X::TypeCheck::BindingType > will be thrown.
2350
2350
2351
- Please note that C < := > is a compile time construct. As such it can not be
2352
- referred to at runtime and thus can't be used as an argument to meta operators.
2351
+ Please note that C < := > is a compile time construct. As such it can not
2352
+ be referred to at runtime and thus can't be used as an argument to
2353
+ metaoperators.
2353
2354
2354
2355
= head2 infix C « ::= »
2355
2356
0 commit comments