package patricia-tree
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=88f2c7c92d609e5a92d2b6242d1d355c85273200f0a1e7e9eab858c4ded09650
sha512=89083fb58c894f5af255172c7bf43e4871bc31afcf86c4cd622773984cd8550ea1e61b31c676c431b6ba5eaf4b4e562ffeaa0cfba893121d783b5cceb7a55623
doc/patricia-tree/PatriciaTree/module-type-HETEROGENEOUS_KEY/index.html
Module type PatriciaTree.HETEROGENEOUS_KEYSource
The signature of heterogeneous keys.
The type of generic/heterogeneous 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 : 'key t -> intA 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.