-
Notifications
You must be signed in to change notification settings - Fork 0
Operators
circular17 edited this page Sep 20, 2023
·
1 revision
Those operators can be applied to sets and to types that are convertible to sets like lists and sequences. Those operators ignore duplicates.
-
A {-} B
is the set difference, so elements in A that are not in B. -
A {+} B
is the set union, so elements that are either in A or B or both. -
A {&} B
is the set intersection, so elements that are in both A and B. -
A {*} B
is the cartesian product, the set of all possible tuples of elements of A and B. -
A {^} n
is the cartesian power, so similar to a cartesian product but done on the same setn
times. -
A {=} B
checks that elements of A are also in B and vice versa, ignoring duplicates. -
A {!=} B
checks A is not equal to B, ignoring duplicates. That's the contrary of above{=}
. -
A {<} B
checks that A is a subset B, but A is different than B. -
A {<=} B
checks that A is subset of B. -
A {>} B
checks that A includes B but A is different than B. -
A {>=} B
checks that A includes B, and A can be equal to B.