Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Added entry on Reduction operators to operators.pod
  • Loading branch information
dha committed Sep 1, 2015
1 parent 1f5b4de commit ee39d98
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions lib/Language/operators.pod
Expand Up @@ -1534,6 +1534,29 @@ roles).
If the C<???> statement is executed, it calls L<&warn>, with the default
message C<stub code executed>.
=head2 Reduction operators
Any infix operator (except for non-associating operators) can be
surrounded by square brackets in term position to create a list operator
that reduces using that operation.
=begin code
[+] 1, 2, 3; # 1 + 2 + 3 = 6
my @a = (5,6);
[*] @a; # 5 * 6 = 30
=end code
Reduction operators have the same associativity as the operators they are based on.
=begin code
[-] 4, 3, 2; # 4-3-2 = (4-3)-2 = -1
[**] 4, 3, 2; # 4**3**2 = 4**(3**2) = 262144
=end code
=head1 Loose AND precedence
=head2 infix C«and»
Expand Down

0 comments on commit ee39d98

Please sign in to comment.