4
4
5
5
= SUBTITLE Common Perl 6 infixes, prefixes, postfixes, and more!
6
6
7
- See L < Sub|/type/Sub > on how to define operators.
7
+ See L < Sub|/type/Sub > on how to define new operators.
8
8
9
9
= head1 Operator precedence
10
10
@@ -2578,7 +2578,7 @@ are based on.
2578
2578
2579
2579
= head1 Loose AND precedence
2580
2580
2581
- = head2 infix C « and »
2581
+ = head2 infix X < C « and » >
2582
2582
2583
2583
Same as L < infix &&|/language/operators#infix_%26%26 > , except with looser
2584
2584
precedence.
@@ -2587,7 +2587,7 @@ Short-circuits so that it returns the first operand that evaluates to
2587
2587
C < False > , otherwise returns the last operand. Note that C < and > is easy
2588
2588
to misuse. See L < traps|/language/traps#Loose_boolean_operators > .
2589
2589
2590
- = head2 infix C « andthen » X < |andthen >
2590
+ = head2 infix X < C « andthen » >
2591
2591
2592
2592
The C < andthen > operator returns
2593
2593
L « C < Empty > |/type/Slip#index-entry-Empty-Empty» upon encountering the
@@ -2628,21 +2628,24 @@ behaviour:
2628
2628
.say with 42;
2629
2629
42 andthen .say;
2630
2630
2631
- = head2 infix C « notandthen »
2631
+ = head2 infix X < C « notandthen » >
2632
2632
2633
- The X < notandthen > operator returns L « C < Empty > |/type/Slip#index-entry-Empty-Empty» upon encountering
2634
- the first L < defined|/routine/defined > argument, otherwise the last argument.
2635
- Last argument is returned as-is, without being checked for definedness at all.
2636
- Short-circuits. The result of the left side is bound to C < $_ > for the
2637
- right side, or passed as arguments if the right side is a
2638
- L « C < Callable > |/type/Callable» , whose L < count|/routine/count > must be C < 0 > or C < 1 > .
2633
+ The C < notandthen > operator returns
2634
+ L « C < Empty > |/type/Slip#index-entry-Empty-Empty» upon encountering the first
2635
+ L < defined|/routine/defined > argument, otherwise the last argument. Last argument
2636
+ is returned as-is, without being checked for definedness at all. Short-circuits.
2637
+ The result of the left side is bound to C < $_ > for the right side, or passed as
2638
+ arguments if the right side is a L « C < Callable > |/type/Callable» , whose
2639
+ L < count|/routine/count > must be C < 0 > or C < 1 > .
2639
2640
2640
- At first glance, L < notandthen|/routine/notandthen > might appear to be the same thing as the L < orelse|/routine/orelse >
2641
- operator. The difference is subtle: L < notandthen|/routine/notandthen > returns
2641
+ At first glance, L < notandthen|/routine/notandthen > might appear to be the same
2642
+ thing as the L < orelse|/routine/orelse > operator. The difference is subtle:
2643
+ L < notandthen|/routine/notandthen > returns
2642
2644
L « C < Empty > |/type/Slip#index-entry-Empty-Empty» when it encounters a
2643
- L < defined|/routine/defined > item (that isn't the last item), whereas L < orelse|/routine/orelse > returns that
2644
- item. In other words, L < notandthen|/routine/notandthen > is a means to act when items aren't
2645
- defined, whereas L < orelse|/routine/orelse > is a means to obtain the first defined item:
2645
+ L < defined|/routine/defined > item (that isn't the last item), whereas
2646
+ L < orelse|/routine/orelse > returns that item. In other words,
2647
+ L < notandthen|/routine/notandthen > is a means to act when items aren't defined,
2648
+ whereas L < orelse|/routine/orelse > is a means to obtain the first defined item:
2646
2649
2647
2650
= begin code
2648
2651
sub all-sensors-down { [notandthen] |@_, True }
0 commit comments