module M:Kwmap.Make
(
sig
typet =
string option
val compare :'a -> 'a -> int
end
)
include struct ... end
val keys : 'a t -> key list
m
: the mapval adjoin : ('a -> 'b -> 'b) -> 'b -> key -> 'a -> 'b t -> 'b t
adjoin vadd empty
returns a function f k v m
that adjoins v
to the
collection of values associated with key k
. vadd
might be cons
and
empty
, []
, or S.add
and S.empty
for some set S
.vadd
: vadd v c
is a function that adds v
to a collection c
,
returning the extended collection.empty
: is the zero element for vadd
k
: keyv
: valuem
: the mapval append : 'a list t -> key -> 'a -> 'a list t
adjoin
.v
to list of values associated with k
m
: the mapk
: keyv
: valueval size : 'a t -> int
m
: the mapval diff : 'a t -> 'b t -> 'a t
a
minus map b
i.e. for each key in b
, remove it from a
a
: minuendb
: subtrahendval replace : key -> 'a -> 'a t -> 'a t
k
and v
in map m
k
: keyv
: valuem
: the mapval of_list : (key * 'a) list -> 'a t -> 'a t
l
: the list of pairsm
: the map to add items toval values : 'a t -> 'a list
m
: the mapval intersect : (key -> 'a -> 'b -> 'c) -> 'a t -> 'b t -> 'c t
the value associated with each key in the new map is a
function of the (shared) key and the two old values
Returns new intersection map
f
: function to apply to the key, the a-value and the b-valuea
: first mapb
: second mapval union : 'a t -> 'a t -> 'a t
a
and b
, keywise, preferring values in b
when keys conflicta
: first mapb
: second mapval incr : ?i:int -> key -> int t -> int t
i
to valuek
valuei
: the increment (default: 1
)k
: the keym
: the mapval to_list : 'a t -> (key * 'a) list
map
: the mapval comparer : ?def:'a -> ?result:int -> (key * 'a) list -> key -> key -> int
Pervasives.compare
-compatible comparison function, using the map as a "sort map"
Parameters def
and result
are mutually exclusive.Pervasives.compare
-compatible comparison functiondef
: default value for any key not in map (default: raise Not_found
)result
: default result (~-1,0,1) for any key not in map (default: raise Not_found
)fs
: alist of keys paired with sort values