Module Belt.MutableSet
The top level provides generic mutable set operations.
It also has two specialized inner modules Belt.MutableSet.Int and Belt.MutableSet.String
A mutable sorted set module which allows customize compare behavior.
Same as Belt.Set, but mutable.
module Int : sig ... endmodule Int: { ... };Specalized when key type is int, more efficient than the generic type
module String : sig ... endmodule String: { ... };Specalized when key type is string, more efficient than the generic type
type ('k, 'id) ttype t('k, 'id);type ('k, 'id) id =
(module Belt__.Belt_Id.Comparable
with type identity = 'id
and type t = 'k)type id('k, 'id) =
(module Belt__.Belt_Id.Comparable
with type identity = 'id
and type t = 'k);val make : id:('value, 'id) id -> ('value, 'id) tlet make: id:id('value, 'id) => t('value, 'id);val fromArray : 'k array -> id:('k, 'id) id -> ('k, 'id) tlet fromArray: array('k) => id:id('k, 'id) => t('k, 'id);val fromSortedArrayUnsafe :
'value array ->
id:('value, 'id) id ->
('value, 'id) tlet fromSortedArrayUnsafe:
array('value) =>
id:id('value, 'id) =>
t('value, 'id);val copy : ('k, 'id) t -> ('k, 'id) tlet copy: t('k, 'id) => t('k, 'id);val isEmpty : (_, _) t -> boollet isEmpty: t(_, _) => bool;val has : ('value, _) t -> 'value -> boollet has: t('value, _) => 'value => bool;val add : ('value, 'id) t -> 'value -> unitlet add: t('value, 'id) => 'value => unit;val addCheck : ('value, 'id) t -> 'value -> boollet addCheck: t('value, 'id) => 'value => bool;val mergeMany : ('value, 'id) t -> 'value array -> unitlet mergeMany: t('value, 'id) => array('value) => unit;val remove : ('value, 'id) t -> 'value -> unitlet remove: t('value, 'id) => 'value => unit;val removeCheck : ('value, 'id) t -> 'value -> boollet removeCheck: t('value, 'id) => 'value => bool;val removeMany : ('value, 'id) t -> 'value array -> unitlet removeMany: t('value, 'id) => array('value) => unit;val union : ('value, 'id) t -> ('value, 'id) t -> ('value, 'id) tlet union: t('value, 'id) => t('value, 'id) => t('value, 'id);val intersect : ('value, 'id) t -> ('value, 'id) t -> ('value, 'id) tlet intersect: t('value, 'id) => t('value, 'id) => t('value, 'id);val diff : ('value, 'id) t -> ('value, 'id) t -> ('value, 'id) tlet diff: t('value, 'id) => t('value, 'id) => t('value, 'id);val subset : ('value, 'id) t -> ('value, 'id) t -> boollet subset: t('value, 'id) => t('value, 'id) => bool;val cmp : ('value, 'id) t -> ('value, 'id) t -> intlet cmp: t('value, 'id) => t('value, 'id) => int;val eq : ('value, 'id) t -> ('value, 'id) t -> boollet eq: t('value, 'id) => t('value, 'id) => bool;val forEachU : ('value, 'id) t -> ('value -> unit) Js.Fn.arity1 -> unitlet forEachU: t('value, 'id) => Js.Fn.arity1(('value => unit)) => unit;val forEach : ('value, 'id) t -> ('value -> unit) -> unitlet forEach: t('value, 'id) => ('value => unit) => unit;forEach m f applies f in turn to all elements of m. In increasing order
val reduceU : ('value, 'id) t -> 'a -> ('a -> 'value -> 'a) Js.Fn.arity2 -> 'alet reduceU: t('value, 'id) => 'a => Js.Fn.arity2(('a => 'value => 'a)) => 'a;val reduce : ('value, 'id) t -> 'a -> ('a -> 'value -> 'a) -> 'alet reduce: t('value, 'id) => 'a => ('a => 'value => 'a) => 'a;In increasing order.
val everyU : ('value, 'id) t -> ('value -> bool) Js.Fn.arity1 -> boollet everyU: t('value, 'id) => Js.Fn.arity1(('value => bool)) => bool;val every : ('value, 'id) t -> ('value -> bool) -> boollet every: t('value, 'id) => ('value => bool) => bool;every s p checks if all elements of the set satisfy the predicate p. Order unspecified
val someU : ('value, 'id) t -> ('value -> bool) Js.Fn.arity1 -> boollet someU: t('value, 'id) => Js.Fn.arity1(('value => bool)) => bool;val some : ('value, 'id) t -> ('value -> bool) -> boollet some: t('value, 'id) => ('value => bool) => bool;some p s checks if at least one element of the set satisfies the predicate p.
val keepU : ('value, 'id) t -> ('value -> bool) Js.Fn.arity1 -> ('value, 'id) tlet keepU: t('value, 'id) => Js.Fn.arity1(('value => bool)) => t('value, 'id);val keep : ('value, 'id) t -> ('value -> bool) -> ('value, 'id) tlet keep: t('value, 'id) => ('value => bool) => t('value, 'id);keep s p returns the set of all elements in s that satisfy predicate p.
val partitionU :
('value, 'id) t ->
('value -> bool) Js.Fn.arity1 ->
('value, 'id) t * ('value, 'id) tlet partitionU:
t('value, 'id) =>
Js.Fn.arity1(('value => bool)) =>
(t('value, 'id), t('value, 'id));val partition :
('value, 'id) t ->
('value -> bool) ->
('value, 'id) t * ('value, 'id) tlet partition:
t('value, 'id) =>
('value => bool) =>
(t('value, 'id), t('value, 'id));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.
val size : ('value, 'id) t -> intlet size: t('value, 'id) => int;val toList : ('value, 'id) t -> 'value listlet toList: t('value, 'id) => list('value);In increasing order
val toArray : ('value, 'id) t -> 'value arraylet toArray: t('value, 'id) => array('value);In increasing order
val minimum : ('value, 'id) t -> 'value optionlet minimum: t('value, 'id) => option('value);val minUndefined : ('value, 'id) t -> 'value Js.undefinedlet minUndefined: t('value, 'id) => Js.undefined('value);val maximum : ('value, 'id) t -> 'value optionlet maximum: t('value, 'id) => option('value);val maxUndefined : ('value, 'id) t -> 'value Js.undefinedlet maxUndefined: t('value, 'id) => Js.undefined('value);val get : ('value, 'id) t -> 'value -> 'value optionlet get: t('value, 'id) => 'value => option('value);val getUndefined : ('value, 'id) t -> 'value -> 'value Js.undefinedlet getUndefined: t('value, 'id) => 'value => Js.undefined('value);val getExn : ('value, 'id) t -> 'value -> 'valuelet getExn: t('value, 'id) => 'value => 'value;val split :
('value, 'id) t ->
'value ->
(('value, 'id) t * ('value, 'id) t) * boollet split:
t('value, 'id) =>
'value =>
((t('value, 'id), t('value, 'id)), bool);split s x returns a triple ((l, r), present), 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. l,r are freshly made, no sharing with s
val checkInvariantInternal : (_, _) t -> unitlet checkInvariantInternal: t(_, _) => unit;raise when invariant is not held