module type S =sig
..end
val shadow_add : ('a, 'b) T.t -> key:'a T.key -> data:'b -> unit
val clear : ('a, 'b) T.t -> unit
val copy : ('a, 'b) T.t -> ('a, 'b) T.t
val create : int -> ('a, 'b) T.t
val shadow_find : ('a, 'b) T.t -> 'a T.key -> 'b list
val fold : ('a, 'b) T.t -> init:'c -> f:(key:'a T.key -> data:'b -> 'c -> 'c) -> 'c
val iter : ('a, 'b) T.t -> f:(key:'a T.key -> data:'b -> unit) -> unit
val length : ('a, 'b) T.t -> int
val mem : ('a, 'b) T.t -> 'a T.key -> bool
val remove : ('a, 'b) T.t -> 'a T.key -> unit
val replace : ('a, 'b) T.t -> key:'a T.key -> data:'b -> unit
val map : ('a, 'b) T.t -> f:('b -> 'c) -> ('a, 'c) T.t
map t f
returns new table with bound values replaced by
f
applied to the bound valuesval mapi : ('a, 'b) T.t -> f:(key:'a T.key -> data:'b -> 'c) -> ('a, 'c) T.t
map
, but function takes both key and data as argumentsval filter_map : ('a, 'b) T.t -> f:('b -> 'c option) -> ('a, 'c) T.t
val filter_mapi : ('a, 'b) T.t -> f:(key:'a T.key -> data:'b -> 'c option) -> ('a, 'c) T.t
filter_map
, but function takes both key and data as argumentsval remove_all : ('a, 'b) T.t -> 'a T.key -> unit
remove_all t k
removes all bindings associated wity key k
from t
.val find_default : ('a, 'b) T.t -> 'a T.key -> default:(unit -> 'b) -> 'b
find_default t k ~default
returns the data associated with key k if it
is in the table t, otherwise it lets d = default() and adds it to the
table.val find : ('a, 'b) T.t -> 'a T.key -> 'b option
find t k
returns Some (the current binding) of k in t, or None if no
such binding existsval find_exn : ('a, 'b) T.t -> 'a T.key -> 'b
find_exn t k
returns the current binding of k in t, or raises Not_found
if no such binding exists.val iter_vals : ('a, 'b) T.t -> f:('b -> unit) -> unit
iter_vals t ~f
is like iter, except it only supplies the value to f,
not the key.val of_alist : ('a T.key * 'b) list -> [ `Duplicate_key of 'a T.key | `Ok of ('a, 'b) T.t ]
of_alist l
returns a new hashtable populated with the supplied dataval of_alist_exn : ('a T.key * 'b) list -> ('a, 'b) T.t
val of_alist_shadow : ('a T.key * 'b) list -> ('a, 'b list) T.t
val to_alist : ('a, 'b) T.t -> ('a T.key * 'b) list
val to_alist_shadow : ('a, 'b) T.t -> ('a T.key * 'b list) list
The result of merge f h1 h2
has as keys the set of all k
in the
union of the sets of keys of h1
and h2
for which d(k)
is not
None, where:
d(k) =
k
in h1
is to d1,
and h2
does not map k
;k
in h2
is to d2,
and h1
does not map k
;k
in h1
is to d1
and the *most recent* binding of k
in h2
is to d2
.k
is mapped to a single piece of data x, where
d(k)
= Some x.val merge : f:(key:'a T.key -> 'b option -> 'c option -> 'd option) ->
('a, 'b) T.t -> ('a, 'c) T.t -> ('a, 'd) T.t
val keys : ('a, 'b) T.t -> 'a T.key list
val data : ('a, 'b) T.t -> 'b list
val filter_inplace : ('a, 'b) T.t -> f:('b -> bool) -> unit
filter_inplace t ~f
removes all the elements from t
that don't
satisfy f
.val filteri_inplace : ('a, 'b) T.t -> f:('a T.key -> 'b -> bool) -> unit
val equal : ('a, 'b) T.t -> ('a, 'b) T.t -> ('b -> 'b -> bool) -> bool
val add_to_groups : ('a T.key, 'a) T.t ->
get_key:('b -> 'a T.key) ->
get_data:('b -> 'a) -> combine:('a -> 'a -> 'a) -> rows:'b list -> unit
val group : ?size:int ->
get_key:('a -> 'b T.key) ->
get_data:('a -> 'b) ->
combine:('b -> 'b -> 'b) -> 'a list -> ('b T.key, 'b) T.t
val create_with_key : get_key:('a -> 'a T.key) -> 'a list -> ('a T.key, 'a) T.t
val create_mapped : get_key:('a -> 'b T.key) ->
get_data:('a -> 'b) -> 'a list -> ('b T.key, 'b) T.t