aboutsummaryrefslogtreecommitdiff
path: root/clib/cMap.mli
diff options
context:
space:
mode:
Diffstat (limited to 'clib/cMap.mli')
-rw-r--r--clib/cMap.mli12
1 files changed, 12 insertions, 0 deletions
diff --git a/clib/cMap.mli b/clib/cMap.mli
index ca6ddb2f4e..9bbb8d50dd 100644
--- a/clib/cMap.mli
+++ b/clib/cMap.mli
@@ -66,6 +66,18 @@ sig
[filter_range] returns the submap of [m] whose keys are in
range. Note that [in_range] has to define a continouous range. *)
+ val update: key -> ('a option -> 'a option) -> 'a t -> 'a t
+ (** [update x f m] returns a map containing the same bindings as
+ [m], except for the binding of [x]. Depending on the value of
+ [y] where [y] is [f (find_opt x m)], the binding of [x] is
+ added, removed or updated. If [y] is [None], the binding is
+ removed if it exists; otherwise, if [y] is [Some z] then [x]
+ is associated to [z] in the resulting map. If [x] was already
+ bound in [m] to a value that is physically equal to [z], [m]
+ is returned unchanged (the result of the function is then
+ physically equal to [m]).
+ *)
+
module Smart :
sig
val map : ('a -> 'a) -> 'a t -> 'a t