AUG_SORTED_DICT signature
The AUG_SORTED_DICT interface specifies a sorted dictionary
augmented with efficient retrieval of the reduced value of all its values.
It is identical to SORTED_DICT
except for the following:
value in place
of 'a.combine and
identity say how values combine.reducedVal function retrieves
reduced values.
The other operations are described on the
SORTED_DICT page.
structure Key : ORDKEY
structure Seq : SEQUENCE
type value
val combine : value * value → value
val identity : value
type t
type dict = t
exception Order
val empty : unit → dict
val singleton : Key.t * value → dict
val fromSeq : (Key.t * value) Seq.t → dict
val toSeq : dict → (Key.t * value) Seq.t
val toString : (value → string) → dict → string
val size : dict → int
val find : dict → Key.t → value option
val insert : dict * (Key.t * value) → dict
val remove : dict * Key.t → dict
val union : dict * dict → dict
val intersection : dict * dict → dict
val difference : dict * dict → dict
val filter : (Key.t * value → bool) → dict → dict
val first : dict → (Key.t * value) option
val last : dict → (Key.t * value) option
val prev : dict * Key.t → (Key.t * value) option
val next : dict * Key.t → (Key.t * value) option
val split : dict * Key.t → dict * value option * dict
val join : dict * dict → dict
val getRange : dict → Key.t * Key.t → dict
val rank : dict * Key.t → int
val select : dict * int → (Key.t * value) option
val reducedVal : dict → value
structure Key :
ORDKEYKey substructure defines the key type of
dictionaries, which are totally ordered according to the provided comparison function.
structure Seq :
SEQUENCESeq substructure defines the underlying sequence type, so that
we may convert dictionaries to and from sequences.
type valuetype ttype dict = tvalue.
The type dict is for readability in the signature.
val combine :
value * value → valueval identity :
valuecombine: combining it with any value $x$, on
either side, gives back $x$.val reducedVal :
dict → valuereducedVal d evaluates to $v_1 \oplus v_2 \oplus \cdots \oplus v_n$,
where $v_1, \ldots, v_n$ are the values of $d$ in increasing order of their keys
and $\oplus$ is combine. It evaluates to identity if
$d$ is empty.