This is documentation for the development version of Patricia Tree,
the latest released version is
v0.10.0.
Click here
to redirect to the latest version.
Patricia Tree API - Key
The type of keys.
It is recommended to use immutable keys. If keys are mutable, any mutations to keys must preserve to_int
. Failing to do so will break the patricia trees' invariants.
val to_int : t -> int
A unique identifier for values of the type. Usually, we use a fresh counter that is increased to give a unique id to each object. Correctness of the operations requires that different values in a tree correspond to different integers.
Must be injective, and ideally fast. hash-consing keys is a good way to generate such unique identifiers.
Note that since Patricia Trees use unsigned order, negative keys are seen as bigger than positive keys. Be wary of this when using negative keys combined with functions like unsigned_max_binding
and pop_unsigned_maximum
.