get_or k m ~default
returns the value associated to k
if present,
and returns default
otherwise (if k
doesn't belong in m
).
update k f m
calls f (Some v)
if find k m = v
,
otherwise it calls f None
. In any case, if the result is None
k
is removed from m
, and if the result is Some v'
then
add k v' m
is returned.
Safe version of find_first.
val merge_safe : f:(key ‑> [ `Left of 'a | `Right of 'b | `Both of 'a * 'b ] ‑> 'c option) ‑> 'a t ‑> 'b t ‑> 'c t
merge_safe ~f a b
merges the maps a
and b
together.
Build a map from the given list of bindings k_i -> v_i
,
added in order using add.
If a key occurs several times, only its last binding
will be present in the result.