@@ -183,3 +183,105 @@ 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
+ @send
250
+ external isSubsetOf: (t<'a>, t<'a>) => bool = "isSubsetOf"
251
+
252
+ /**
253
+ Returns a bool indicating if the all values in the given set are in the set.
254
+
255
+ ## Examples
256
+ ```rescript
257
+ let set1 = Set.fromArray(["apple", "banana", "pear"])
258
+ let set2 = Set.fromArray(["apple", "banana"])
259
+ set1->Set.isSupersetOf(set2) // true
260
+ ```
261
+ */
262
+ @send
263
+ external isSupersetOf: (t<'a>, t<'a>) => bool = "isSupersetOf"
264
+
265
+ /**
266
+ Returns a new set with the values of the set that are in both the set and the other set.
267
+
268
+ ## Examples
269
+ ```rescript
270
+ let set1 = Set.fromArray(["apple", "orange", "banana"])
271
+ let set2 = Set.fromArray(["apple", "banana", "pear"])
272
+ set1->Set.union(set2) // Set.fromArray(["apple", "orange", "banana", "pear"])
273
+ ```
274
+ */
275
+ @send
276
+ external union: (t<'a>, t<'a>) => t<'a> = "union"
277
+
278
+ /**
279
+ `toArray(set)` returns an array of all values of the set.
280
+
281
+ ## Examples
282
+ ```rescript
283
+ let set = Set.fromArray(["apple", "orange", "apple", "banana"])
284
+ set->Set.toArray // ["apple", "orange", "banana"]
285
+ ```
286
+ */
287
+ external toArray: t<'a> => array<'a> = "Array.from"
0 commit comments