get_or k m ~default returns the value associated to k if present, and returns default otherwise (if k doesn't belong in m).
since
0.16
val update : key->('a option->'a option)->'at->'at
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 Nonek is removed from m, and if the result is Some v' then add k v' m is returned.
find_first f m where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists. See Map.S.find_first.
since
1.5
val find_first_opt : (key-> bool)->'at->(key * 'a) option
find_first_opt f m where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists. Safe version of find_first.
since
1.5
val merge_safe : f:(key->[ `Left of 'a| `Right of 'b| `Both of 'a * 'b ]->'c option)->'at->'bt->'ct
merge_safe ~f a b merges the maps a and b together.
of_list l builds a map from the given list l 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.
get_or k m ~default returns the value associated to k if present, and returns default otherwise (if k doesn't belong in m).
since
0.16
val update : key->('a option->'a option)->'at->'at
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 Nonek is removed from m, and if the result is Some v' then add k v' m is returned.
find_first f m where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists. See Map.S.find_first.
since
1.5
val find_first_opt : (key-> bool)->'at->(key * 'a) option
find_first_opt f m where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists. Safe version of find_first.
since
1.5
val merge_safe : f:(key->[ `Left of 'a| `Right of 'b| `Both of 'a * 'b ]->'c option)->'at->'bt->'ct
merge_safe ~f a b merges the maps a and b together.
of_seq seq builds a map from the given Seq.t of bindings. Like of_list. Renamed from of_std_seq since 3.0.
since
3.0
val of_seq_with : f:(key->'a->'a->'a)->(key * 'a) Stdlib.Seq.t->'at
of_seq_with ~f l builds a map from the given seq l of bindings k_i -> v_i, added in order using add. If a key occurs several times, all its bindings are combined using the function f, with f key v1 v2 being called with v1 occurring later in the seq than v2.
of_iter iter builds a map from the given iter of bindings. Like of_list.
since
2.8
val of_iter_with : f:(key->'a->'a->'a)->(key * 'a)iter->'at
of_iter_with ~f l builds a map from the given iter l of bindings k_i -> v_i, added in order using add. If a key occurs several times, all its bindings are combined using the function f, with f key v1 v2 being called with v1 occurring later in the iter than v2.
of_list l builds a map from the given list l 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.
val of_list_with : f:(key->'a->'a->'a)->(key * 'a) list->'at
of_list_with ~f l builds a map from the given list l of bindings k_i -> v_i, added in order using add. If a key occurs several times, all its bindings are combined using the function f, with f key v1 v2 being called with v1 occurring later in the list than v2.