package patricia-tree

  1. Overview
  2. Docs
Patricia Tree data structure in OCaml for maps and sets. Supports generic key-value pairs

Install

Dune Dependency

Authors

Maintainers

Sources

patricia-tree-0.11.0.tbz
sha256=18fcde5d35d65c9bb2f9ec4ff732ecdd8969ba6fc2cf51d29ecb3be66e2fe664
sha512=da038d5096deb4bf3c02efd694e962ecf9b2571d140fa1fef17cce474f628ec070b93a44fd742748b9d3ba0e51041f864623d83e9cb0c72214abb0fb4a043625

doc/patricia-tree/PatriciaTree/module-type-HETEROGENEOUS_KEY/index.html

Module type PatriciaTree.HETEROGENEOUS_KEYSource

The signature of heterogeneous keys.

type 'key t

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 -> 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.

val polyeq : 'a t -> 'b t -> ('a, 'b) cmp

Polymorphic equality function used to compare our keys. It should satisfy (to_int a) = (to_int b) ==> polyeq a b = Eq, and be fast.

OCaml

Innovation. Community. Security.