@@ -102,6 +102,9 @@ X<Membership operator>.
102
102
103
103
Returns C < True > if C < $a > is an B < element > of C < $b > .
104
104
105
+ say 2 (elem) (1, 2, 3).Set; # OUTPUT: «True»
106
+ say 4 (elem) (1, 2, 3).Set; # OUTPUT: «False»
107
+
105
108
= head4 infix ∈
106
109
107
110
only sub infix:<∈>($a, $b --> Bool)
@@ -119,6 +122,9 @@ X<Non-membership operator>.
119
122
Equivalent to C < !(elem) > , i.e., returns C < True > if C < $a > is not an element
120
123
of C < $b > , at codepoint U+2209 (NOT AN ELEMENT OF).
121
124
125
+ say 2 !(elem) (1, 2, 3).Set; # OUTPUT: «False»
126
+ say 4 !(elem) (1, 2, 3).Set; # OUTPUT: «True»
127
+
122
128
= head3 infix (cont)
123
129
124
130
multi sub infix:<(cont)>(Any $a, $b --> Bool)
@@ -128,6 +134,9 @@ X<Contains operator>.
128
134
129
135
Returns C < True > if C < $a > B < contains > C < $b > as an element.
130
136
137
+ say (1, 2, 3).Set (cont) 2; # OUTPUT: «True»
138
+ say (1, 2, 3).Set (cont) 4; # OUTPUT: «False»
139
+
131
140
= head4 infix ∋
132
141
133
142
only sub infix:<∋>($a, $b --> Bool)
@@ -145,6 +154,9 @@ X<Does not contain operator>.
145
154
Equivalent to C < !(cont) > , i.e., returns C < True > if C < $a > does not contain
146
155
C < $b > , at codepoint U+220C (DOES NOT CONTAIN AS MEMBER).
147
156
157
+ say (1, 2, 3).Set !(cont) 2; # OUTPUT: «False»
158
+ say (1, 2, 3).Set !(cont) 4; # OUTPUT: «True»
159
+
148
160
= head3 infix (<=)
149
161
150
162
multi sub infix:<<(<=)>>(Any $a, Any $b --> Bool)
@@ -156,6 +168,10 @@ Returns C<True> if C<$a> is a B<subset> or is equal to C<$b>, i.e., if all
156
168
the elements of C < $a > are elements of C < $b > and C < $a > is a smaller or equal
157
169
sized set than C < $b > .
158
170
171
+ say (1, 2, 3).Set (<=) (3, 2, 1).Set; # OUTPUT: «True»
172
+ say (1, 3).Set (<=) (2, 1).Set; # OUTPUT: «False»
173
+ say ∅ (<=) (3, 2, 1).Set; # OUTPUT: «True»
174
+
159
175
= head4 infix ⊆
160
176
161
177
only sub infix:<⊆>($a, $b --> Bool)
@@ -172,6 +188,9 @@ X<Neither subset of nor equal to operator>.
172
188
173
189
Equivalent to C « !(<=) » , at codepoint U+2288 (NEITHER A SUBSET OF NOR EQUAL TO).
174
190
191
+ say (1, 2, 3).Set !(<=) (3, 2, 1).Set; # OUTPUT: «False»
192
+ say (1, 3).Set ⊈ (2, 1).Set; # OUTPUT: «True»
193
+
175
194
= head3 infix (<)
176
195
177
196
multi sub infix:<<(<)>>(Any $a, Any $b --> Bool)
@@ -183,6 +202,10 @@ Returns C<True> if C<$a> is a B<strict subset> of C<$b>, i.e., that all the
183
202
elements of C < $a > are elements of C < $b > but C < $a > is a smaller set than
184
203
C < $b > .
185
204
205
+ say (1, 2, 3).Set (<) (3, 2, 1).Set; # OUTPUT: «False»
206
+ say (1, 3).Set (<) (3, 2, 1).Set; # OUTPUT: «True»
207
+ say ∅ (<) (3, 2, 1).Set; # OUTPUT: «True»
208
+
186
209
= head4 infix ⊂
187
210
188
211
only sub infix:<⊂>($a, $b --> Bool)
@@ -199,6 +222,9 @@ X<Not a subset of operator>.
199
222
200
223
Equivalent to C « !(<) » , at codepoint U+2284 (NOT A SUBSET OF).
201
224
225
+ say (1, 2, 3).Set !(<) (3, 2, 1).Set; # OUTPUT: «True»
226
+ say (1, 3).Set ⊄ (3, 2, 1).Set; # OUTPUT: «False»
227
+
202
228
= head3 infix (>=)
203
229
204
230
multi sub infix:<<(>=)>>(Any $a, Any $b --> Bool)
@@ -209,6 +235,10 @@ X<Superset of or equal to operator>.
209
235
Like L « (<=) » with reversed arguments. Returns C < True > if C < $a > is a
210
236
B < superset > of or equal to C < $b > .
211
237
238
+ say (1, 2, 3).Set (>=) (3, 2, 1).Set; # OUTPUT: «True»
239
+ say (1, 3).Set (>=) (3, 2, 1).Set; # OUTPUT: «False»
240
+ say ∅ (>=) (3, 2, 1).Set; # OUTPUT: «False»
241
+
212
242
= head4 infix ⊇
213
243
214
244
only sub infix:<⊇>($a, $b --> Bool)
@@ -226,6 +256,9 @@ X<Neither a superset of nor equal to operator>.
226
256
Equivalent to C « !(>=) » , at codepoint U+2289 (NEITHER A SUPERSET OF
227
257
NOR EQUAL TO).
228
258
259
+ say (1, 2, 3).Set !(>=) (3, 2, 1).Set; # OUTPUT: «False»
260
+ say (1, 3).Set ⊉ (3, 2, 1).Set; # OUTPUT: «True»
261
+
229
262
= head3 infix (>)
230
263
231
264
multi sub infix:<<(>)>>(Any $a, Any $b --> Bool)
@@ -236,6 +269,10 @@ X<Superset of operator>.
236
269
Like L « (<) » with reversed arguments. Returns C < True > if C < $a > is a
237
270
B < strict superset > of C < $b > .
238
271
272
+ say (1, 2, 3, 4).Set (>) (3, 2, 1).Set; # OUTPUT: «True»
273
+ say (1, 3).Set (>) (3, 2, 1).Set; # OUTPUT: «False»
274
+ say ∅ (>) (3, 2, 1).Set; # OUTPUT: «False»
275
+
239
276
= head4 infix ⊃
240
277
241
278
only sub infix:<⊃>($a, $b --> Bool)
@@ -252,6 +289,9 @@ X<Not a superset of operator>.
252
289
253
290
Equivalent to C « !(>) » , at codepoint U+2285 (NOT A SUPERSET OF).
254
291
292
+ say (1, 2, 3, 4).Set !(>) (3, 2, 1).Set; # OUTPUT: «False»
293
+ say (1, 3).Set ⊅ (3, 2, 1).Set; # OUTPUT: «True»
294
+
255
295
= head3 infix (<+)
256
296
257
297
multi sub infix:<<(<+)>>(Any $a, Any $b --> Bool)
@@ -263,6 +303,9 @@ Returns C<True> if C<$a> is a Baggy B<subset> of C<$b>, i.e., if all the
263
303
elements of C < $a > are in C < $b > and each element of C < $b > is weighed at
264
304
least as heavily as the element is in C < $a > .
265
305
306
+ say (1, 2, 3).Bag (<+) (3, 2, 1).Bag; # OUTPUT: «True»
307
+ say (1, 2, 2, 3).Bag (<+) (3, 2, 1).Bag; # OUTPUT: «False»
308
+
266
309
= head4 infix ≼
267
310
268
311
only sub infix:<≼>($a, $b --> Bool)
@@ -282,6 +325,10 @@ Returns C<True> if C<$a> is a Baggy B<superset> of C<$b>, i.e., if all the
282
325
elements of C < $b > are in C < $a > and no element of C < $b > is weighted heavier
283
326
than that element is in C < $a > .
284
327
328
+ say (1, 2, 3).Bag (>+) (3, 2, 1).Bag; # OUTPUT: «True»
329
+ say (1, 2, 2, 3).Bag (>+) (3, 2, 1).Bag; # OUTPUT: «True»
330
+ say (1, 2).Bag (>+) (3, 2, 1).Bag; # OUTPUT: «False»
331
+
285
332
= head4 infix ≽
286
333
287
334
only sub infix:<≽>($a, $b --> Bool)
0 commit comments