Library
Module
Module type
Parameter
Class
Class type
Lazy tries based on lists
include Sexplib0.Sexpable.S2 with type ('a, 'b) t := ('a, 'b) t
val t_of_sexp :
(Sexplib0.Sexp.t -> 'a) ->
(Sexplib0.Sexp.t -> 'b) ->
Sexplib0.Sexp.t ->
('a, 'b) t
val sexp_of_t :
('a -> Sexplib0.Sexp.t) ->
('b -> Sexplib0.Sexp.t) ->
('a, 'b) t ->
Sexplib0.Sexp.t
val empty : ('a, 'b) t
Create a new trie with the given components
val mem : ('a, 'b) t -> 'a list -> bool
Returns true if there is a value associated with the given path
val find : ('a, 'b) t -> 'a list -> 'b
Returns the value associated with the given path.
Associates a value with the given path, or replaces if there was already one
Removes an association from the trie. Warning: doesn't cleanup branches that don't point to anything anymore
map_subtree tree path f
applies f
on value and children of the node found at path
in tree
, and bind the returned node back at that position in the tree
val iter : ('a list -> 'b -> unit) -> ('a, 'b) t -> unit
iters over all the bindings in the trie, top-down
val fold : ('acc -> 'a list -> 'b -> 'acc) -> ('a, 'b) t -> 'acc -> 'acc
folds over all bindings of the trie, bottom-up
Maps and filters over all values in the trie, removing the value if None
is returned
sub t p
returns the sub-trie associated with the path p
in the trie t
. If p
is not a valid path of t
, it returns an empty trie.
filter f t
returns t with all subtrees for which f key = false
pruned
graft tree path node
grafts node
in tree
at path