Utils.Tree_mapA persistent map implemented as a balanced binary tree. The sexp_of function preserves and displays the tree structure.
A persistent map implemented as a balanced binary tree. The sexp_of function preserves and displays the tree structure.
val empty : ('a, 'b) tval height : ('a, 'b) t -> Base.intval balance_factor : ('a, 'b) t -> Base__Int.tval find : compare:('a -> 'b -> int) -> key:'a -> ('b, 'c) t -> 'c optionval mem : compare:('a -> 'b -> int) -> key:'a -> ('b, 'c) t -> boolval fold : ('a, 'b) t -> init:'c -> f:(key:'a -> data:'b -> 'c -> 'c) -> 'cval iter : ('a, 'b) t -> f:(key:'a -> data:'b -> unit) -> unitval sparse_mapi :
compare:('a -> 'b -> int) ->
targets:'a Base.List.t ->
('b, 'c) t ->
f:(key:'b -> data:'c -> 'c) ->
('b, 'c) tsparse_mapi ~compare ~targets t ~f is mapi t ~f restricted to the keys in targets: every other entry keeps its value, and subtrees holding no target are shared, not copied. The tree's shape is unchanged, and f runs on the targets in the order mapi would run it on them: the expression below has mapi's shape, so it inherits its evaluation order. targets needs no order or uniqueness; keys absent from t are ignored.
val to_alist : ('a, 'b) t -> ('a * 'b) Base.List.tval of_alist : compare:('a -> 'a -> int) -> ('a * 'b) Base.List.t -> ('a, 'b) tval sexp_of_t :
('a -> Base.Sexp.t) ->
('b -> Base.Sexp.t) ->
('a, 'b) t ->
Base.Sexp.tSexp conversion that preserves tree structure