@@ -183,3 +183,106 @@ Console.log(set->Set.values->Iterator.toArray)
183
183
*/
184
184
@send
185
185
external values: t<'a> => Core__Iterator.t<'a> = "values"
186
+
187
+ /**
188
+ Returns a new set with the values of the set that are not in the other set.
189
+
190
+ ## Examples
191
+ ```rescript
192
+ let set1 = Set.fromArray(["apple", "orange", "banana"])
193
+ let set2 = Set.fromArray(["apple", "banana", "pear"])
194
+ set1->Set.difference(set2) // Set.fromArray(["orange"])
195
+ ```
196
+ */
197
+ @send
198
+ external difference: (t<'a>, t<'a>) => t<'a> = "difference"
199
+
200
+ /**
201
+ Returns a new set with the values containing the values which are in either the set, but not in both.
202
+
203
+ ## Examples
204
+ ```rescript
205
+ let set1 = Set.fromArray(["apple", "orange", "banana"])
206
+ let set2 = Set.fromArray(["apple", "banana", "pear"])
207
+ set1->Set.symmetricDifference(set2) // Set.fromArray(["orange", "pear"])
208
+ ```
209
+
210
+ */
211
+ @send
212
+ external symmetricDifference: (t<'a>, t<'a>) => t<'a> = "symmetricDifference"
213
+
214
+ /**
215
+ Returns a new set with the values containing the values which are in both the set and the other set.
216
+
217
+ ## Examples
218
+ ```rescript
219
+ let set1 = Set.fromArray(["apple", "orange", "banana"])
220
+ let set2 = Set.fromArray(["apple", "banana", "pear"])
221
+ set1->Set.intersection(set2) // Set.fromArray(["apple", "banana"])
222
+ ```
223
+ */
224
+ @send
225
+ external intersection: (t<'a>, t<'a>) => t<'a> = "intersection"
226
+
227
+ /**
228
+ Returns a bool indicating if this set has no elements in common with the given set.
229
+
230
+ ## Examples
231
+ ```rescript
232
+ let set1 = Set.fromArray(["apple", "orange", "banana"])
233
+ let set2 = Set.fromArray(["kiwi", "melon", "pear"])
234
+ set1->Set.isDisjointFrom(set2) // true
235
+ ```
236
+ */
237
+ @send
238
+ external isDisjointFrom: (t<'a>, t<'a>) => bool = "isDisjointFrom"
239
+
240
+ /**
241
+ Returns a bool indicating if the all values in the set are in the given set.
242
+
243
+ ## Examples
244
+ ```rescript
245
+ let set1 = Set.fromArray(["apple", "banana"])
246
+ let set2 = Set.fromArray(["apple", "banana", "pear"])
247
+ set1->Set.isSubsetOf(set2) // true
248
+ ```
249
+ */
250
+ @send
251
+ external isSubsetOf: (t<'a>, t<'a>) => bool = "isSubsetOf"
252
+
253
+ /**
254
+ Returns a bool indicating if the all values in the given set are in the set.
255
+
256
+ ## Examples
257
+ ```rescript
258
+ let set1 = Set.fromArray(["apple", "banana", "pear"])
259
+ let set2 = Set.fromArray(["apple", "banana"])
260
+ set1->Set.isSupersetOf(set2) // true
261
+ ```
262
+ */
263
+ @send
264
+ external isSupersetOf: (t<'a>, t<'a>) => bool = "isSupersetOf"
265
+
266
+ /**
267
+ Returns a new set with the values of the set that are in both the set and the other set.
268
+
269
+ ## Examples
270
+ ```rescript
271
+ let set1 = Set.fromArray(["apple", "orange", "banana"])
272
+ let set2 = Set.fromArray(["apple", "banana", "pear"])
273
+ set1->Set.union(set2) // Set.fromArray(["apple", "orange", "banana", "pear"])
274
+ ```
275
+ */
276
+ @send
277
+ external union: (t<'a>, t<'a>) => t<'a> = "union"
278
+
279
+ /**
280
+ `toArray(set)` returns an array of all values of the set.
281
+
282
+ ## Examples
283
+ ```rescript
284
+ let set = Set.fromArray(["apple", "orange", "apple", "banana"])
285
+ set->Set.toArray // ["apple", "orange", "banana"]
286
+ ```
287
+ */
288
+ external toArray: t<'a> => array<'a> = "Array.from"
0 commit comments