module Map.NumStringMap:A map on strings. Strings are handled as prefix + number (i.e. "abc23" < "abc123", "abc012" = "abc12")Extlib.ExtMap.Map.S
with type key = String.t
type
key
type +'a
t
key
to type 'a
.val empty : 'a Map.S.t
val is_empty : 'a Map.S.t -> bool
val add : Map.S.key ->
'a -> 'a Map.S.t -> 'a Map.S.t
add x y m
returns a map containing the same bindings as
m
, plus a binding of x
to y
. If x
was already bound
in m
, its previous binding disappears.val find : Map.S.key -> 'a Map.S.t -> 'a
find x m
returns the current binding of x
in m
,
or raises Not_found
if no such binding exists.val remove : Map.S.key ->
'a Map.S.t -> 'a Map.S.t
remove x m
returns a map containing the same bindings as
m
, except for x
which is unbound in the returned map.val mem : Map.S.key -> 'a Map.S.t -> bool
mem x m
returns true
if m
contains a binding for x
,
and false
otherwise.val iter : (Map.S.key -> 'a -> unit) -> 'a Map.S.t -> unit
iter f m
applies f
to all bindings in map m
.
f
receives the key as first argument, and the associated value
as second argument. The bindings are passed to f
in increasing
order with respect to the ordering over the type of the keys.
Only current bindings are presented to f
:
bindings hidden by more recent bindings are not passed to f
.val map : ('a -> 'b) -> 'a Map.S.t -> 'b Map.S.t
map f m
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.val mapi : (Map.S.key -> 'a -> 'b) ->
'a Map.S.t -> 'b Map.S.t
Map.S.map
, but the function receives as arguments both the
key and the associated value for each binding of the map.val fold : (Map.S.key -> 'a -> 'b -> 'b) ->
'a Map.S.t -> 'b -> 'b
fold f m a
computes (f kN dN ... (f k1 d1 a)...)
,
where k1 ... kN
are the keys of all bindings in m
(in increasing order), and d1 ... dN
are the associated data.val filter : ('a -> bool) -> 'a Map.S.t -> 'a Map.S.t
filter f m
returns a map where only the values a
of m
such that f a = true
remain. The bindings are passed to f
in increasing order with respect to the ordering over the
type of the keys.val filteri : (Map.S.key -> 'a -> bool) ->
'a Map.S.t -> 'a Map.S.t
filter f m
returns a map where only the key, values pairs
key
, a
of m
such that f key a = true
remain. The
bindings are passed to f
in increasing order with respect
to the ordering over the type of the keys.val filter_map : (Map.S.key -> 'a -> 'b option) ->
'a Map.S.t -> 'b Map.S.t
filter_map f m
combines the features of filteri
and
map
. It calls calls f key0 a0
, f key1 a1
, f keyn an
where a0..an
are the elements of m
and key0..keyn
the
respective corresponding keys. It returns the map of
pairs keyi
,bi
such as f keyi ai = Some bi
(when f
returns
None
, the corresponding element of m
is discarded).val compare : ('a -> 'a -> int) ->
'a Map.S.t -> 'a Map.S.t -> int
val equal : ('a -> 'a -> bool) ->
'a Map.S.t -> 'a Map.S.t -> bool
equal cmp m1 m2
tests whether the maps m1
and m2
are
equal, that is, contain equal keys and associate them with
equal data. cmp
is the equality predicate used to compare
the data associated with the keys.val keys : 'a Map.S.t -> Map.S.key Enum.t
val values : 'a Map.S.t -> 'a Enum.t
val enum : 'a Map.S.t -> (Map.S.key * 'a) Enum.t
val of_enum : (Map.S.key * 'a) Enum.t -> 'a Map.S.t
val t_of_sexp : (Sexplib.Sexp.t -> Map.S.key) ->
(Sexplib.Sexp.t -> 'a) -> Sexplib.Sexp.t -> 'a Map.S.t
val sexp_of_t : (Map.S.key -> Sexplib.Sexp.t) ->
('a -> Sexplib.Sexp.t) -> 'a Map.S.t -> Sexplib.Sexp.t
val print : ?first:string ->
?last:string ->
?sep:string ->
('a Extlib.InnerIO.output -> Map.S.key -> unit) ->
('a Extlib.InnerIO.output -> 'b -> unit) ->
'a Extlib.InnerIO.output -> 'b Map.S.t -> unit
Map.Make
.Map
with functions
behaving slightly differently but having the same name. This is by design:
the functions meant to override the corresponding functions of Map
.
To take advantage of these overrides, you probably want to
or . For instance, to open a version of Map
with exceptionless error management, you may write
open Map, Exceptionless. To locally replace module
Map
with a module of
the same name but with exceptionless error management, you may
write module Map = Map include Exceptionless.
module Extlib.ExtMap.Map.S.Exceptionless:sig
..end
Map
without exceptions.
module Extlib.ExtMap.Map.S.Labels:sig
..end
Map
with labels.