package conex

  1. Overview
  2. Docs

Tree is a simple tree datatype, edge is a string, values are 'a lists.

type 'a t

The main tree type

val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool

equal eq a b compares a with b, using eq to compare values.

val empty : 'a t

empty is the only constructor of a tree.

val is_empty : 'a t -> bool
val sub : path -> 'a t -> 'a t
val fold : (path -> 'a list -> 'b -> 'b) -> 'b -> 'a t -> 'b

fold f acc t folds f over t, using the accumulator acc.

val pp : (Format.formatter -> 'a -> unit) -> Format.formatter -> 'a t -> unit

pp pp_e ppf t pretty prints the tree t using pp_e for printing values.

val lookup : path -> 'a t -> 'a list option

lookup path t returns either Some values or None.

val lookup_prefix : path -> 'a t -> 'a list

lookup_prefix path t finds the closest non-empty 'a on path.

val insert : path -> 'a -> 'a t -> 'a t

insert path value t inserts value into t at path. If the key is already in the tree, its value is prepended.

OCaml

Innovation. Community. Security.