module Map: Utilsigs.OrderedMap
include Map.S
val pp : (Format.formatter -> 'a -> unit) -> Format.formatter -> 'a t -> unit
pp pp_val fmt map
pretty prints map
using pp_val
to pretty-print
the *values* of map
. *Keys* are pretty-printed using the pp
function
of the BasicType
for keys.
val to_string : ('a -> string) -> 'a t -> string
to_string val_to_string map
converts to a string, using val_to_string
to convert *values* to strings.
val hash : ('a -> int) -> 'a t -> int
Hash the map using the provided function for hashing *values*.
val of_list : (key * 'a) list -> 'a t
Create a map out of a list of pairs of (keys, values).
val to_list : 'a t -> (key * 'a) list
Create a list of pairs (keys, values) out of a map.
val endomap : (key * 'a -> key * 'b) -> 'a t -> 'b t
Convert a map to another, by enumerating bindings in key order,
converting them into new ones and adding them to a new map.
Bindings created earlier have precedence.
val union : 'a t -> 'a t -> 'a t
Union two maps. Bindings in the first map have precedence.
val find_map : (key -> 'a -> bool) -> 'a t -> (key * 'a) option
Optimisation for finding and converting at the same time. find_map f map
will return f k v
for the first k
,v
in map
such that f k v
is not None
,
or None
otherwise.
val fixpoint : ('a -> 'a -> bool) -> ('a t -> 'a t) -> 'a t -> 'a t
fixpoint val_equal f map
computes the fixpoint of f
using val_equal
to compare *values*.
val submap : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
Decide if a map is included in another, using the provided value equality
predicate.
val add_bindings : (key * 'a) list -> 'a t -> 'a t
Add all bindings in provided list to map. Bindings already in the map
have precedence.