module String:S
with type key = string and type char_ = char
type
char_
type
key
type 'a
t
val empty : 'a t
val is_empty : 'a t -> bool
val add : key -> 'a -> 'a t -> 'a t
val remove : key -> 'a t -> 'a t
val find : key -> 'a t -> 'a option
val find_exn : key -> 'a t -> 'a
val longest_prefix : key -> 'a t -> key
longest_prefix k m
finds the longest prefix of k
that leads to
at least one path in m
(it does not mean that the prefix is bound to
a value.
Example: if m
has keys "abc0" and "abcd", then longest_prefix "abc2" m
will return "abc"
Since 0.17
val update : key -> ('a option -> 'a option) -> 'a t -> 'a t
None
if the key is absent, or Some v
if key
is bound to v
;
if it returns None
the key is removed, otherwise it
returns Some y
and key
becomes bound to y
val fold : ('b -> key -> 'a -> 'b) -> 'b -> 'a t -> 'b
CCTrie.WORD.of_list
to rebuild keys.val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t
val map : ('a -> 'b) -> 'a t -> 'b t
val iter : (key -> 'a -> unit) -> 'a t -> unit
CCTrie.S.fold
, but for effectful functionsval fold_values : ('b -> 'a -> 'b) -> 'b -> 'a t -> 'b
CCTrie.S.fold
, that doesn't keep keysval iter_values : ('a -> unit) -> 'a t -> unit
val merge : ('a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t
val size : 'a t -> int
val to_list : 'a t -> (key * 'a) list
val of_list : (key * 'a) list -> 'a t
val to_seq : 'a t -> (key * 'a) CCTrie.sequence
val of_seq : (key * 'a) CCTrie.sequence -> 'a t
val to_seq_values : 'a t -> 'a CCTrie.sequence
val to_tree : 'a t ->
[ `Char of char_ | `Switch | `Val of 'a ] CCTrie.ktree
val above : key -> 'a t -> (key * 'a) CCTrie.sequence
val below : key -> 'a t -> (key * 'a) CCTrie.sequence