File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -226,11 +226,18 @@ C<%outer »+» %inner;> only keys of %inner that exist in %outer will occur in
226
226
= head2 Reduction Operators
227
227
228
228
Reduction operators apply any infix operator, surrounded by C < [ > and C < ] > ,
229
- element by element and return the resulting value. They can be defined as a
230
- list prefix operators or will be generated automatically.
229
+ element by element and return the resulting value.
231
230
232
231
say [+] 1,2,3; # 6
233
232
233
+ They can be defined as a list prefix operators or will be generated automatically.
234
+
235
+ multi infix:<[~~]> (@c, &test) is looser(&infix:<~~>) {
236
+ gather for @c { take $_ if test($_) }
237
+ };
238
+ my @l = 1,'a',2,'b';
239
+ say @l [~~] {$^a ~~ Str}; # (a b)
240
+
234
241
For list infix operators, flattening is not done on the input list. This
235
242
allowes list operators to become the reduction operator.
236
243
You can’t perform that action at this time.
0 commit comments