Module Lazy_trie
Lazy tries based on lists
val empty : ('a, 'b) tval create : ?children:('a * ('a, 'b) t) list Stdlib.Lazy.t -> ?value:'b -> unit -> ('a, 'b) tCreate a new trie with the given components
val mem : ('a, 'b) t -> 'a list -> boolReturns true if there is a value associated with the given path
val find : ('a, 'b) t -> 'a list -> 'bReturns the value associated with the given path.
- raises [Not_found]
val set : ('a, 'b) t -> 'a list -> 'b -> ('a, 'b) tAssociates a value with the given path, or replaces if there was already one
val set_lazy : ('a, 'b) t -> 'a list -> 'b Stdlib.Lazy.t -> ('a, 'b) tThe same but taking a lazy value
val unset : ('a, 'b) t -> 'a list -> ('a, 'b) tRemoves an association from the trie. Warning: doesn't cleanup branches that don't point to anything anymore
val map_subtree : ('a, 'b) t -> 'a list -> (('a, 'b) t -> ('a, 'b) t) -> ('a, 'b) tmap_subtree tree path fappliesfon value and children of the node found atpathintree, and bind the returned node back at that position in the tree
val iter : ('a list -> 'b -> unit) -> ('a, 'b) t -> unititers over all the bindings in the trie, top-down
val fold : ('acc -> 'a list -> 'b -> 'acc) -> ('a, 'b) t -> 'acc -> 'accfolds over all bindings of the trie, bottom-up
val map_filter_values : ('b -> 'c option) -> ('a, 'b) t -> ('a, 'c) tMaps and filters over all values in the trie, removing the value if
Noneis returned
val sub : ('a, 'b) t -> 'a list -> ('a, 'b) tsub t preturns the sub-trie associated with the pathpin the triet. Ifpis not a valid path oft, it returns an empty trie.
val filter_keys : ('a -> bool) -> ('a, 'b) t -> ('a, 'b) tfilter f treturns t with all subtrees for whichf key = falsepruned