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