Int

This module is Belt.Set specialized with value type to be a primitive type. It is more efficient in general, the API is the same with Belt_Set except its value type is fixed, and identity is not needed(using the built-in one)

See Belt.Set

add

RES
let add: (t, value) => t

add(s, x) If x was already in s, s is returned unchanged.

checkInvariantInternal

RES
let checkInvariantInternal: t => unit

throw when invariant is not held

cmp

RES
let cmp: (t, t) => int

Total ordering between sets. Can be used as the ordering function for doing sets of sets.

diff

RES
let diff: (t, t) => t

empty

RES
let empty: t

eq

RES
let eq: (t, t) => bool

eq(s1, s2) tests whether the sets s1 and s2 are equal, that is, contain equal elements.

every

RES
let every: (t, value => bool) => bool

every(p, s) checks if all elements of the set satisfy the predicate p. Order unspecified.

everyU

Deprecated

Use every instead

RES
let everyU: (t, value => bool) => bool

forEach

RES
let forEach: (t, value => unit) => unit

forEach(s, f) applies f in turn to all elements of s. In increasing order

forEachU

Deprecated

Use forEach instead

RES
let forEachU: (t, value => unit) => unit

fromArray

RES
let fromArray: array<value> => t

fromSortedArrayUnsafe

RES
let fromSortedArrayUnsafe: array<value> => t

get

RES
let get: (t, value) => option<value>

getExn

RES
let getExn: (t, value) => value

getOrThrow

RES
let getOrThrow: (t, value) => value

getUndefined

RES
let getUndefined: (t, value) => Js.undefined<value>

has

RES
let has: (t, value) => bool

intersect

RES
let intersect: (t, t) => t

isEmpty

RES
let isEmpty: t => bool

keep

RES
let keep: (t, value => bool) => t

keep(p, s) returns the set of all elements in s that satisfy predicate p.

keepU

Deprecated

Use keep instead

RES
let keepU: (t, value => bool) => t

maximum

RES
let maximum: t => option<value>

maxUndefined

RES
let maxUndefined: t => Js.undefined<value>

mergeMany

RES
let mergeMany: (t, array<value>) => t

minimum

RES
let minimum: t => option<value>

minUndefined

RES
let minUndefined: t => Js.undefined<value>

partition

RES
let partition: (t, value => bool) => (t, t)

partition(p, s) returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate p, and s2 is the set of all the elements of s that do not satisfy p.

partitionU

Deprecated

Use partition instead

RES
let partitionU: (t, value => bool) => (t, t)

reduce

RES
let reduce: (t, 'a, ('a, value) => 'a) => 'a

Iterate in increasing order.

reduceU

Deprecated

Use reduce instead

RES
let reduceU: (t, 'a, ('a, value) => 'a) => 'a

remove

RES
let remove: (t, value) => t

remove(m, x) If x was not in m, m is returned reference unchanged.

removeMany

RES
let removeMany: (t, array<value>) => t

size

RES
let size: t => int

some

RES
let some: (t, value => bool) => bool

some(p, s) checks if at least one element of the set satisfies the predicate p. Oder unspecified.

someU

Deprecated

Use some instead

RES
let someU: (t, value => bool) => bool

split

RES
let split: (t, value) => ((t, t), bool)

split(x, s) returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x;r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

subset

RES
let subset: (t, t) => bool

subset(s1, s2) tests whether the set s1 is a subset of the set s2.

t

RES
type t

The type of sets.

toArray

RES
let toArray: t => array<value>

toList

RES
let toList: t => list<value>

In increasing order

union

RES
let union: (t, t) => t

value

RES
type value = int

The type of the set elements.