Skip to content

Commit 0ca780d

Browse files
committed
Add infix C«(elem)», infix C«∈», infix C«∉» to operators
1 parent 02d5e3c commit 0ca780d

File tree

1 file changed

+32
-22
lines changed

1 file changed

+32
-22
lines changed

doc/Language/operators.pod6

Lines changed: 32 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2183,6 +2183,38 @@ Note that setting $*TOLERANCE = 0 will cause all comparisons to fail.
21832183
say 1 =~= 1; # OUTPUT: «False␤»
21842184
}
21852185
2186+
=head2 infix C«(elem)», infix C«»
2187+
2188+
multi sub infix:<(elem)>($a,$b --> Bool:D)
2189+
multi sub infix:<∈>($a,$b --> Bool:D)
2190+
2191+
X<Membership operator>.
2192+
2193+
Returns C<True> if C<$a> is an B<element> of C<$b>.
2194+
2195+
=begin code
2196+
say 2 (elem) (1, 2, 3); # OUTPUT: «True␤»
2197+
say 4 ∈ (1, 2, 3); # OUTPUT: «False␤»
2198+
=end code
2199+
2200+
C«» is equivalent to C«(elem)», at codepoint U+2208 (ELEMENT OF).
2201+
2202+
=head2 infix C«»
2203+
2204+
multi sub infix:<∉>($a,$b --> Bool:D)
2205+
2206+
X<Non-membership operator>.
2207+
2208+
Returns C<True> if C<$a> is B<not> an B<element> of C<$b>. Equivalent to
2209+
C<!(elem)>.
2210+
2211+
=begin code
2212+
say 4 ∉ (1, 2, 3); # OUTPUT: «True␤»
2213+
say 2 !(elem) (1, 2, 3); # OUTPUT: «False␤»
2214+
=end code
2215+
2216+
C«» is codepoint U+2209 (NOT AN ELEMENT OF).
2217+
21862218
=head1 Tight AND precedence
21872219
21882220
=head2 infix C«&&»
@@ -3127,28 +3159,6 @@ This summary those operators are included for completeness.
31273159
31283160
=head2 Operators that return C<Bool>
31293161
3130-
=head3 infix (elem)
3131-
3132-
X<Membership operator>.
3133-
3134-
Returns C<True> if C<$a> is an B<element> of C<$b>.
3135-
3136-
=head3 infix ∈
3137-
3138-
Alternate X<membership operator>, at codepoint U+2208 (ELEMENT OF).
3139-
3140-
Equivalent to L«(elem)|/routine/(elem)»,
3141-
3142-
=head3 infix !(elem)
3143-
3144-
X<Non-membership operator>.
3145-
3146-
Returns C<True> if C<$a> is B<not an element> of C<$b>.
3147-
3148-
=head3 infix ∉
3149-
3150-
Alternate X<non-membership operator>, at codepoint U+2209 (NOT AN ELEMENT OF).
3151-
31523162
=head3 infix (cont)
31533163
31543164
X<Contains operator>.

0 commit comments

Comments
 (0)