This is documentation for version v0.9.0 of patricia-tree,
        but the latest version is
        v0.11.0.
        
        Click here
        to redirect to the latest version.
      
     Patricia Tree API - SimpleNode
      This module is such that 'map t = 'map view.
We use a uniform type 'map view to pattern match on maps and sets The actual types 'map t can be a bit different from 'map view to allow for more efficient representations, but view should be a constant time operation for quick conversions.
Parameters
module Key : sig ... endSignature
Types
type 'a key = 'a Key.tThe type of keys.
type ('key, 'map) value = ('key, 'map) Value.tThe type of value, which depends on the type of the key and the type of the map.
Constructors: build values
val empty : 'map tThe empty map
A singleton leaf, similar to BASE_MAP.singleton
A branch node. This shouldn't be called externally unless you know what you're doing! Doing so could easily break the data structure's invariants.
When called, it assumes that:
- Neither tree0nortree1should be empty.
- branching_bitshould have a single bit set
- prefixshould be normalized (bits below- branching_bitset to zero)
- All elements of tree0should have theirto_intstart byprefixfollowed by 0 at positionbranching_bit).
- All elements of tree1should have theirto_intstart byprefixfollowed by 0 at positionbranching_bit).
Destructors: access the value
type 'map view = private - | Empty : 'map view(*- Can happen only at the toplevel: there is no empty interior node. *)
- | Branch : {- } -> 'map view(*- Branching bit contains only one bit set; the corresponding mask is (branching_bit - 1). The prefixes are normalized: the bits below the branching bit are set to zero (i.e. prefix & (branching_bit - 1) = 0). *)
- | Leaf : {- } -> 'map view(*- A key -> value mapping. *)
This makes the map nodes accessible to the pattern matching algorithm; this corresponds 1:1 to the SimpleNode implementation. This just needs to be copy-and-pasted for every node type.
val is_empty : 'map t -> boolCheck if the map is empty. Should be constant time.