Int
This module is Belt.MutableSet
specialized with key type to be a primitive type.
It is more efficient in general, the API is the same with Belt.MutableSet
except its key type is fixed,
and identity is not needed(using the built-in one)
See Belt.MutableSet
value
type value = int
The type of the set elements.
t
type t
The type of sets.
make
let make: unit => t
fromArray
let fromArray: array<value> => t
fromSortedArrayUnsafe
let fromSortedArrayUnsafe: array<value> => t
copy
let copy: t => t
isEmpty
let isEmpty: t => bool
has
let has: (t, value) => bool
add
let add: (t, value) => unit
addCheck
let addCheck: (t, value) => bool
mergeMany
let mergeMany: (t, array<value>) => unit
remove
let remove: (t, value) => unit
removeCheck
let removeCheck: (t, value) => bool
removeMany
let removeMany: (t, array<value>) => unit
union
let union: (t, t) => t
intersect
let intersect: (t, t) => t
diff
let diff: (t, t) => t
subset
let subset: (t, t) => bool
cmp
let cmp: (t, t) => int
eq
let eq: (t, t) => bool
forEachU
let forEachU: (t, value => unit) => unit
forEach
let forEach: (t, value => unit) => unit
In increasing order
reduceU
let reduceU: (t, 'a, ('a, value) => 'a) => 'a
reduce
let reduce: (t, 'a, ('a, value) => 'a) => 'a
Iterate in increasing order.
everyU
let everyU: (t, value => bool) => bool
every
let every: (t, value => bool) => bool
every(p, s)
checks if all elements of the set satisfy the predicate p
.
Order unspecified.
someU
let someU: (t, value => bool) => bool
some
let some: (t, value => bool) => bool
some(p, s)
checks if at least one element of the set satisfies the predicate
p
. Oder unspecified.
keepU
let keepU: (t, value => bool) => t
keep
let keep: (t, value => bool) => t
keep(s, p)
returns a fresh copy of the set of all elements in s
that satisfy
predicate p
.
partitionU
let partitionU: (t, value => bool) => (t, t)
partition
let partition: (t, value => bool) => (t, t)
partition(s, p)
returns a fresh copy 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
.
size
let size: t => int
toList
let toList: t => list<value>
In increasing order with respect
toArray
let toArray: t => array<value>
In increasing order with respect
minimum
let minimum: t => option<value>
minUndefined
let minUndefined: t => Js.undefined<value>
maximum
let maximum: t => option<value>
maxUndefined
let maxUndefined: t => Js.undefined<value>
get
let get: (t, value) => option<value>
getUndefined
let getUndefined: (t, value) => Js.undefined<value>
getExn
let getExn: (t, value) => value
split
let split: (t, value) => ((t, t), bool)
split(s, key)
return a fresh copy of each
checkInvariantInternal
let checkInvariantInternal: t => unit
raise when invariant is not held