Library
Module
Module type
Parameter
Class
Class type
A finite map implemented by a B tree.
module Key : Interfaces.SORTABLE
include Interfaces.MAP with type key = Key.t
type key = Key.t
Type of the keys
val is_empty : 'a t -> bool
Is the map empty?
val cardinal : 'a t -> int
cardinal map
The cardinality of the map i.e. the number of key value pairs in the map.
fold_left f start map
Fold the bindings in the map map
from left to right i.e. lexically ascending using the start value start
for the accumulator and the folding function f
where f
is applied f accue key value
yielding a new accumulator by consuming one key value pair.
fold_left f start map
Fold the bindings in the map map
from right to left i.e. lexically descending using the start value start
for the accumulator and the folding function f
where f
is applied f accu key value
yielding a new accumulator by consuming one key value pair.
find_opt key map
Find the value which is bound to the key key
in the map map
. Return None
if no value is bound to key
.
val empty : 'a t
The empty map.
add key value map
Add the key value pair key, value
to the map. If the map has already a key value pair with the key key
then overwrite the old value with the new value.
remove key map
Remove the key value pair with the key key
from the map map
. If the key is not present, then do nothing.
update key f map
Update the value bound to the key key
in the map map
by the update function f
. If no value is bound to key
then f None
is called. If value
is bound to key
then f (Some value)
is called.
If f
returns None
then no value is added and the old binding is deleted (if it existed before).
If f
return Some new_value
then the old value is updated, if existed, or the new value is added if no old value existed before.
module Source (Value : Interfaces.ANY) : sig ... end