module Hashmap: sig
.. end
Module implementing polymorphic unbounded maps (environments).
val default_size : int
The default size of the hash used in the implementation
class [['a, 'b]]
hashmap : ?size:int -> unit ->
object
.. end
The hashmap class
type ('a, 'b)
t = ('a, 'b) hashmap
The abstract type of an hashmap.
val make : ?size:int -> unit -> ('a, 'b) t
The hashmap constructor.
val lookup : ('a, 'b) t -> 'a -> 'b
Return the object bound to the given key, or raise Not_found:
val mem : ('a, 'b) t -> 'a -> 'b -> bool
The member predicate.
val memq : ('a, 'b) t -> 'a -> 'b -> bool
The member predicate with the physical equality.
val bound : ('a, 'b) t -> 'a -> bool
Answer if x is bound in the map.
val add : ('a, 'b) t -> 'a -> 'b -> unit
Add a binding to the hashmap.
val add_list : ('a, 'b) t -> ('a * 'b) list -> unit
Add all the binding from the given alist to the map. In case of multiple values
for a single key it's undefined which value prevails.
val replace : ('a, 'b) t -> 'a -> 'b -> unit
Replace or add (when not existing) a binding to a map.
val remove : ('a, 'b) t -> 'a -> unit
Remove one or all (default) bindings of the given key.
val update : ('a, 'b) t -> ('a, 'b) t -> unit
update t1 t2
updates the map t1
adding all the bindings from t2
.
val to_list : ('a, 'b) t -> ('a * 'b) list
Make an alist from an hashmap, returning the bindings as <key, value> pairs in some
unspecified order.
val of_list : ?size:int -> ('a * 'b) list -> ('a, 'b) t
Make a new hashmap from an alist made of <key, value> pairs. If more than one
binding is specified for a single key it's undefined which value prevails.