Functor CCTrie.MakeList

module MakeList (X : ORDERED: S  with type key = X.t list and type char_ = X.t
Parameters:
X : ORDERED

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
Add a binding to the trie (possibly erasing the previous one)
val remove : key -> 'a t -> 'a t
Remove the key, if present
val find : key -> 'a t -> 'a option
Find the value associated with the key, if any
val find_exn : key -> 'a t -> 'a
Same as CCTrie.S.find but can fail.
Raises Not_found if the key is not present
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
Update the binding for the given key. The function is given 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
Fold on key/value bindings. Will use CCTrie.WORD.of_list to rebuild keys.
val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t
Map values, giving both key and value. Will use CCTrie.WORD.of_list to rebuild keys.
Since 0.17
val map : ('a -> 'b) -> 'a t -> 'b t
Map values, giving only the value.
Since 0.17
val iter : (key -> 'a -> unit) -> 'a t -> unit
Same as CCTrie.S.fold, but for effectful functions
val fold_values : ('b -> 'a -> 'b) -> 'b -> 'a t -> 'b
More efficient version of CCTrie.S.fold, that doesn't keep keys
val iter_values : ('a -> unit) -> 'a t -> unit
val merge : ('a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t
Merge two tries together. The function is used in case of conflicts, when a key belongs to both tries
val size : 'a t -> int
Number of bindings

Conversions

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

Ranges

val above : key -> 'a t -> (key * 'a) CCTrie.sequence
All bindings whose key is bigger or equal to the given key, in ascending order
val below : key -> 'a t -> (key * 'a) CCTrie.sequence
All bindings whose key is smaller or equal to the given key, in decreasing order