MakeCustom.Node
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.
type 'a key = 'a Key.t
The type of keys.
type ('key, 'map) value = ('key, 'map) Value.t
The type of value, which depends on the type of the key and the type of the map.
val empty : 'map t
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 -> bool