File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -1534,6 +1534,29 @@ roles).
1534
1534
If the C < ??? > statement is executed, it calls L < &warn > , with the default
1535
1535
message C < stub code executed > .
1536
1536
1537
+ = head2 Reduction operators
1538
+
1539
+ Any infix operator (except for non-associating operators) can be
1540
+ surrounded by square brackets in term position to create a list operator
1541
+ that reduces using that operation.
1542
+
1543
+ = begin code
1544
+
1545
+ [+] 1, 2, 3; # 1 + 2 + 3 = 6
1546
+ my @a = (5,6);
1547
+ [*] @a; # 5 * 6 = 30
1548
+
1549
+ = end code
1550
+
1551
+ Reduction operators have the same associativity as the operators they are based on.
1552
+
1553
+ = begin code
1554
+
1555
+ [-] 4, 3, 2; # 4-3-2 = (4-3)-2 = -1
1556
+ [**] 4, 3, 2; # 4**3**2 = 4**(3**2) = 262144
1557
+
1558
+ = end code
1559
+
1537
1560
= head1 Loose AND precedence
1538
1561
1539
1562
= head2 infix C « and »
You can’t perform that action at this time.
0 commit comments