Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add equality set operators #3685

Merged
merged 2 commits into from Nov 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
34 changes: 33 additions & 1 deletion doc/Language/operators.pod6
Expand Up @@ -58,7 +58,7 @@ assigned to that level (column labeled C<A>), and some exemplary operators
X | Junctive or | \| ^ (\|) (^) (\+) (-) ∪ ⊖ ⊎ ∖
L | Named unary | temp let
N | Structural infix | but does <=> leg unicmp cmp coll .. ..^ ^.. ^..^
C | Chaining infix | != ≠ == < <= ≤ > >= ≥ eq ne lt le gt ge ~~ === eqv !eqv =~= ≅ (elem) (cont) (<) (>) (<=) (>=) (<\+) (>\+) ∈ ∉ ∋ ∌ ⊂ ⊄ ⊃ ⊅ ⊆ ⊈ ⊇ ⊉ ≼ ≽
C | Chaining infix | != ≠ == < <= ≤ > >= ≥ eq ne lt le gt ge ~~ === eqv !eqv =~= ≅ (elem) (cont) (<) (>) (<=) (>=) (<\+) (>\+) (==) ∈ ∉ ∋ ∌ ≡ ≢ ⊂ ⊄ ⊃ ⊅ ⊆ ⊈ ⊇ ⊉ ≼ ≽
X | Tight and | &&
X | Tight or | \|\| ^^ // min max
R | Conditional | ?? !! ff ff^ ^ff ^ff^ fff fff^ ^fff ^fff^
Expand Down Expand Up @@ -2481,6 +2481,38 @@ C<!(elem)>.

C«∉» is codepoint U+2209 (NOT AN ELEMENT OF).

=head2 infix C«≡»

multi sub infix:<≡>($a,$b --> Bool:D)

X<Set equality operator>

Returns C<True> if C<$a> and C<$b> are B<identical>. Equivalent to
C<(==)>.

=begin code
say (1, 2, 3) ≡ (1, 3, 2); # OUTPUT: «True␤»
say (1, 2, 3) ≡ (1, 2, 4); # OUTPUT: «False␤»
=end code

C«≡» is codepoint U+2261 (IDENTICAL TO).

=head2 infix C«≢»

multi sub infix:<≢>($a,$b --> Bool:D)

X<Set equality operator>

Returns C<True> if C<$a> and C<$b> are B<not identical>. Equivalent to
C<!(==)>.

=begin code
say (1, 2, 3) ≢ (1, 2, 4); # OUTPUT: «True␤»
say (1, 2, 3) ≢ (1, 3, 2); # OUTPUT: «False␤»
=end code

C«≢» is codepoint U+2262 (NOT IDENTICAL TO).

=head2 infix (cont), infix ∋

multi sub infix:<(cont)>($a,$b --> Bool:D)
Expand Down
12 changes: 12 additions & 0 deletions doc/Language/setbagmix.pod6
Expand Up @@ -174,6 +174,18 @@ Returns C<True> if C<$a> is B<not> a B<strict superset> of C<$b>, else C<False>.
L<More information|/language/operators#infix_⊅>,
L<Wikipedia definition|https://en.wikipedia.org/wiki/Subset#Definitions>.

=head3 infix (==), infix ≡

Returns C<True> if C<$a> and C<$b> are B<identical>, else C<False>.
L<More information|/language/operators#infix_≡>,
L<Wikipedia definition|https://en.wikipedia.org/wiki/Equality_(mathematics)#Equality_in_set_theory>.

=head3 infix ≢

Returns C<True> if C<$a> and C<$b> are B<not identical>, else C<False>.
L<More information|/language/operators#infix_≢>,
L<Wikipedia definition|https://en.wikipedia.org/wiki/Equality_(mathematics)#Equality_in_set_theory>.

=head2 Set operators that return a C<QuantHash>

=head3 infix (|), infix ∪
Expand Down
4 changes: 3 additions & 1 deletion doc/Language/unicode_ascii.pod6
Expand Up @@ -53,7 +53,7 @@ line), or C<Zp> (Separator, paragraph) property.
This list contains the single codepoints [and their ASCII
equivalents] that have a special meaning in Raku.

X<|«>X<|»>X<|×>X<|÷>X<|≤>X<|≥>X<|≠>X<|−>X<|∘>X<|≅>X<|π>X<|τ>X<|𝑒>X<|∞>X<|…>X<|‘>X<|’>X<|‚>X<|“>X<|”>X<|„>X<|「>X<|」>X<|⁺>X<|⁻>X<|¯>X<|⁰>X<|¹>X<|²>X<|³>X<|⁴>X<|⁵>X<|⁶>X<|⁷>X<|⁸>X<|⁹>X<|∈>X<|∉>X<|∋>X<|∌>X<|⊆>X<|⊈>X<|⊂>X<|⊄>X<|⊇>X<|⊉>X<|⊃>X<|⊅>X<|≼>X<|≽>X<|∪>X<|∩>X<|∖>X<|⊖>X<|⊍>X<|⊎>
X<|«>X<|»>X<|×>X<|÷>X<|≤>X<|≥>X<|≠>X<|−>X<|∘>X<|≅>X<|π>X<|τ>X<|𝑒>X<|∞>X<|…>X<|‘>X<|’>X<|‚>X<|“>X<|”>X<|„>X<|「>X<|」>X<|⁺>X<|⁻>X<|¯>X<|⁰>X<|¹>X<|²>X<|³>X<|⁴>X<|⁵>X<|⁶>X<|⁷>X<|⁸>X<|⁹>X<|∈>X<|∉>X<|∋>X<|∌>X<|≡>X<|≢>X<|⊆>X<|⊈>X<|⊂>X<|⊄>X<|⊇>X<|⊉>X<|⊃>X<|⊅>X<|≼>X<|≽>X<|∪>X<|∩>X<|∖>X<|⊖>X<|⊍>X<|⊎>
JJ marked this conversation as resolved.
Show resolved Hide resolved
=table
Symbol | Codepoint | ASCII | Remarks
=======|===========|============|=========================
Expand Down Expand Up @@ -98,6 +98,8 @@ X<|«>X<|»>X<|×>X<|÷>X<|≤>X<|≥>X<|≠>X<|−>X<|∘>X<|≅>X<|π>X<|τ>X<
∉ | U+2209 | !(elem) |
∋ | U+220B | (cont) |
∌ | U+220C | !(cont) |
≡ | U+2261 | (==) |
≢ | U+2262 | !(==) |
⊆ | U+2286 | (<=) |
⊈ | U+2288 | !(<=) |
⊂ | U+2282 | (<) |
Expand Down
2 changes: 2 additions & 0 deletions doc/Language/unicode_entry.pod6
Expand Up @@ -307,6 +307,8 @@ C<Ctrl-Shift-u> in Bash) then the unicode code point hexadecimal number.
∉ U+2209 !(elem)
∋ U+220B (cont)
∌ U+220C !(cont)
≡ U+2261 (==)
≢ U+2262 !(==)
⊆ U+2286 (<=)
⊈ U+2288 !(<=)
⊂ U+2282 (<)
Expand Down