AUG_BST signature
The AUG_BST signature is an interface for an augmented binary
search tree with fixed key and value types. It is identical to
BST except for the type
value of its values, which takes the
place of 'a, the values combine
and identity, which say how values
combine, and the addition of reducedVal.
The operations shared with BST are described there.
structure Key : ORDKEY
type value
val combine : value * value → value
val identity : value
type t
type bst = t
type nodeview = { left : bst,
key : Key.t,
value : value,
right : bst }
exception Order
val empty : unit → bst
val size : bst → int
val expose : bst → nodeview option
val joinMid : bst * (Key.t * value) * bst → bst
val reducedVal : bst → value
structure Key : ORDKEYKey substructure defines the key type of a binary search
tree, providing comparison and other useful functions on keys.
type valuetype ttype bst = ttype nodeview =
{ left : bst, key : Key.t, value : value, right : bst }val combine :
value * value → valueval identity :
valuecombine: combining it with any value $x$, on
either side, gives back $x$.val reducedVal :
bst → valuereducedVal T evaluates to $v_1 \oplus v_2 \oplus \cdots \oplus v_n$,
where $v_1, \ldots, v_n$ are the values of $T$ in increasing order of their keys
and $\oplus$ is combine. It evaluates to identity if
$T$ is empty.