MutableMapString
key
REStype key = string
t
REStype t<'a>
make
RESlet make: unit => t<'a>
clear
RESlet clear: t<'a> => unit
isEmpty
RESlet isEmpty: t<'a> => bool
has
RESlet has: (t<'a>, key) => bool
cmpU
RESlet cmpU: (t<'a>, t<'a>, (. 'a, 'a) => int) => int
cmp
RESlet cmp: (t<'a>, t<'a>, ('a, 'a) => int) => int
cmp(m1, m2, cmp)
First compare by size, if size is the same, compare by key, value pair.
eqU
RESlet eqU: (t<'a>, t<'a>, (. 'a, 'a) => bool) => bool
eq
RESlet eq: (t<'a>, t<'a>, ('a, 'a) => bool) => bool
eq(m1, m2, cmp)
forEachU
RESlet forEachU: (t<'a>, (. key, 'a) => unit) => unit
forEach
RESlet forEach: (t<'a>, (key, 'a) => unit) => unit
forEach(m, f)
applies f
to all bindings in map m
. f
receives the key as first argument, and the associated value as second argument. The application order of f
is in increasing order.
reduceU
RESlet reduceU: (t<'a>, 'b, (. 'b, key, 'a) => 'b) => 'b
reduce
RESlet reduce: (t<'a>, 'b, ('b, key, 'a) => 'b) => 'b
reduce(m, a, f), computes
(f(kN, dN) ... (f(k1, d1, a))...), where
k1 ... kNare the keys of all bindings in
m(in increasing order), and
d1 ... dN` are the associated data.
everyU
RESlet everyU: (t<'a>, (. key, 'a) => bool) => bool
every
RESlet every: (t<'a>, (key, 'a) => bool) => bool
every(m, p)
checks if all the bindings of the map satisfy the predicate p
. The application order of p
is unspecified.
someU
RESlet someU: (t<'a>, (. key, 'a) => bool) => bool
some
RESlet some: (t<'a>, (key, 'a) => bool) => bool
some(m, p)
checks if at least one binding of the map satisfy the predicate p
. The application order of p
is unspecified.
size
RESlet size: t<'a> => int
toList
RESlet toList: t<'a> => list<(key, 'a)>
In increasing order
toArray
RESlet toArray: t<'a> => array<(key, 'a)>
fromArray
RESlet fromArray: array<(key, 'a)> => t<'a>
keysToArray
RESlet keysToArray: t<'a> => array<key>
valuesToArray
RESlet valuesToArray: t<'a> => array<'a>
minKey
RESlet minKey: t<'a> => option<key>
minKeyUndefined
RESlet minKeyUndefined: t<'a> => Js.undefined<key>
maxKey
RESlet maxKey: t<'a> => option<key>
maxKeyUndefined
RESlet maxKeyUndefined: t<'a> => Js.undefined<key>
minimum
RESlet minimum: t<'a> => option<(key, 'a)>
minUndefined
RESlet minUndefined: t<'a> => Js.undefined<(key, 'a)>
maximum
RESlet maximum: t<'a> => option<(key, 'a)>
maxUndefined
RESlet maxUndefined: t<'a> => Js.undefined<(key, 'a)>
get
RESlet get: (t<'a>, key) => option<'a>
getUndefined
RESlet getUndefined: (t<'a>, key) => Js.undefined<'a>
getWithDefault
RESlet getWithDefault: (t<'a>, key, 'a) => 'a
getExn
RESlet getExn: (t<'a>, key) => 'a
checkInvariantInternal
RESlet checkInvariantInternal: t<'a> => unit
Raise when invariant is not held.
remove
RESlet remove: (t<'a>, key) => unit
remove(m, x)
do the in-place modification.
removeMany
RESlet removeMany: (t<'a>, array<key>) => unit
set
RESlet set: (t<'a>, key, 'a) => unit
set(m, x, y)
do the in-place modification, return m
for chaining. If x
was already bound in m
, its previous binding disappears.
updateU
RESlet updateU: (t<'a>, key, (. option<'a>) => option<'a>) => unit
update
RESlet update: (t<'a>, key, option<'a> => option<'a>) => unit
mapU
RESlet mapU: (t<'a>, (. 'a) => 'b) => t<'b>
map
RESlet map: (t<'a>, 'a => 'b) => t<'b>
map(m, f)
returns a map with same domain as m
, where the associated value a of all bindings of m
has been replaced by the result of the application of f
to a
. The bindings are passed to f
in increasing order with respect to the ordering over the type of the keys.
mapWithKeyU
RESlet mapWithKeyU: (t<'a>, (. key, 'a) => 'b) => t<'b>
mapWithKey
RESlet mapWithKey: (t<'a>, (key, 'a) => 'b) => t<'b>