module Make: functor (
Ord
:
Map.OrderedType
) ->
sig
.. end
include struct ... end
val keys : 'a t -> key list
list of keys in map in ascending order
m
: the map
val 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
: key
v
: value
m
: the map
val append : 'a list t -> key -> 'a -> 'a list t
Deprecated.You should use adjoin
.
append v
to list of values associated with k
m
: the map
k
: key
v
: value
val size : 'a t -> int
size of map (number of keys)
m
: the map
val diff : 'a t -> 'b t -> 'a t
map a
minus map b
i.e. for each key in b
, remove it from a
a
: minuend
b
: subtrahend
val replace : key -> 'a -> 'a t -> 'a t
replace the mapping for k
and v
in map m
k
: key
v
: value
m
: the map
val of_list : (key * 'a) list -> 'a t -> 'a t
add a list of (key,value) pairs (i.e. an alist) to a map
Returns a new map extended by the pairs
l
: the list of pairs
m
: the map to add items to
val values : 'a t -> 'a list
return list of all values in map
Returns the list
m
: the map
val intersect : (key -> 'a -> 'b -> 'c) -> 'a t -> 'b t -> 'c t
return the intersection of two maps, based on keys
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-value
a
: first map
b
: second map
val union : 'a t -> 'a t -> 'a t
keywise union of two maps
Returns new map which is the union of a
and b
, keywise, preferring values in b
when keys conflict
a
: first map
b
: second map
val incr : ?i:int -> key -> int t -> int t
use a map value to count a key, adding i
to value
Returns new map with incremented k
value
i
: the increment (default: 1
)
k
: the key
m
: the map
val to_list : 'a t -> (key * 'a) list
create a list (association list) from the items in a map
Returns the list
map
: the map
val comparer : ?def:'a -> ?result:int -> (key * 'a) list -> key -> key -> int
generate a Pervasives.compare
-compatible comparison function, using the map as a "sort map"
Parameters def
and result
are mutually exclusive.
Returns Pervasives.compare
-compatible comparison function
def
: 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