Functor CCHashTrie.Make

module Make (K : KEY: S  with type key = K.t

Functors


Parameters:
K : KEY

type key 
type 'a t 
val empty : 'a t
val is_empty : 'a t -> bool
val singleton : key -> 'a -> 'a t
val add : key -> 'a -> 'a t -> 'a t
val mem : key -> 'a t -> bool
val get : key -> 'a t -> 'a option
val get_exn : key -> 'a t -> 'a
Raises Not_found if key not present
val remove : key -> 'a t -> 'a t
Remove the key, if present.
val update : key ->
f:('a option -> 'a option) -> 'a t -> 'a t
update k ~f m calls f (Some v) if get k m = Some v, None otherwise. Then, if f returns Some v' it binds k to v', if f returns None it removes k
val add_mut : id:CCHashTrie.Transient.t ->
key -> 'a -> 'a t -> 'a t
add_mut ~id k v m behaves like add k v m, except it will mutate in place whenever possible. Changes done with an id might affect all versions of the structure obtained with the same id (but not other versions).
Raises Transient.Frozen if id is frozen
val remove_mut : id:CCHashTrie.Transient.t ->
key -> 'a t -> 'a t
Same as CCHashTrie.S.remove, but modifies in place whenever possible
Raises Transient.Frozen if id is frozen
val update_mut : id:CCHashTrie.Transient.t ->
key ->
f:('a option -> 'a option) -> 'a t -> 'a t
Same as CCHashTrie.S.update but with mutability
Raises Transient.Frozen if id is frozen
val cardinal : 'a t -> int
val choose : 'a t -> (key * 'a) option
val choose_exn : 'a t -> key * 'a
Raises Not_found if not pair was found
val iter : f:(key -> 'a -> unit) -> 'a t -> unit
val fold : f:('b -> key -> 'a -> 'b) -> x:'b -> 'a t -> 'b

Conversions

val to_list : 'a t -> (key * 'a) list
val add_list : 'a t -> (key * 'a) list -> 'a t
val add_list_mut : id:CCHashTrie.Transient.t ->
'a t -> (key * 'a) list -> 'a t
Raises Frozen if the ID is frozen
val of_list : (key * 'a) list -> 'a t
val add_seq : 'a t ->
(key * 'a) CCHashTrie.sequence -> 'a t
val add_seq_mut : id:CCHashTrie.Transient.t ->
'a t ->
(key * 'a) CCHashTrie.sequence -> 'a t
Raises Frozen if the ID is frozen
val of_seq : (key * 'a) CCHashTrie.sequence -> 'a t
val to_seq : 'a t -> (key * 'a) CCHashTrie.sequence
val add_gen : 'a t ->
(key * 'a) CCHashTrie.gen -> 'a t
val add_gen_mut : id:CCHashTrie.Transient.t ->
'a t ->
(key * 'a) CCHashTrie.gen -> 'a t
Raises Frozen if the ID is frozen
val of_gen : (key * 'a) CCHashTrie.gen -> 'a t
val to_gen : 'a t -> (key * 'a) CCHashTrie.gen

IO

val print : key CCHashTrie.printer ->
'a CCHashTrie.printer -> 'a t CCHashTrie.printer
val as_tree : 'a t ->
[ `L of int * (key * 'a) list | `N ] CCHashTrie.ktree
For debugging purpose: explore the structure of the tree, with `L (h,l) being a leaf (with shared hash h) and `N an inner node