Skip to content

Commit

Permalink
Remove the "user defined" example in the Reduction Operators section
Browse files Browse the repository at this point in the history
As far as I can see, this example does not belong here.
Contrary to what it claims, it doesn't define a reduce operator - it
merely defines a completely custom operator that happens to use
square brackets in its symbol.
Nor is is the functionality it implements related to reduce -
rather, it seems to re-implement (part of) the functionality of the
built-in `map` routine.
  • Loading branch information
smls committed Aug 19, 2016
1 parent 000a24d commit 234e846
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions doc/Language/operators.pod6
Expand Up @@ -320,14 +320,6 @@ function instead of an operator, provide an additional layer of brackets:
sub plus { $^a + $^b };
say [[&plus]] 1, 2, 3; # 6
They can be defined as list prefix operators or will be generated automatically.
multi infix:<[~~]> (@c, &test) is looser(&infix:<~~>) {
gather for @c { take $_ if test($_) }
};
my @l = 1, 'a', 2, 'b';
say @l [~~] {$^a ~~ Str}; # (a b)
The argument list is iterated without flattening. This means that you can pass
a nested list to the reducing form of a list infix operator:
Expand Down

0 comments on commit 234e846

Please sign in to comment.