ST_SEQUENCE
signature
The ST_SEQUENCE
signature is a minimalistic interface for a
single-threaded sequence type. Single-threaded sequences differ
from normal sequences in that they are only meant to be used in
single-threaded applications — that is to say, updates should only be
made on the most recently modified version of the type. However, operations
on single-threaded sequences are always well-defined, regardless of
context.
structure Seq : SEQUENCE
type α t
type α stseq = α t
exception Range
val fromSeq : α Seq.t → α stseq
val toSeq : α stseq → α Seq.t
val nth : α stseq → int → α
val update : (α stseq * (int * α)) → α stseq
val inject : (α stseq * (int * α) Seq.t) → α stseq
structure Seq :
SEQUENCE
Seq
substructure defines the underlying sequence type to
and from which single-threaded sequences can be converted.
type α t
type α stseq = α t
α t
, for readability.exception Range
Range
is raised whenever an
invalid index into a single-threaded sequence is used.val fromSeq :
α Seq.t → α stseq
val toSeq :
α stseq → α Seq.t
val nth :
α stseq → int → α
(nth s i)
evaluates to si, the ith element of s.
Raises Range
if i is out of
bounds.
val update :
(α stseq * (int * α)) → α stseq
(update (s, (i, x)))
evaluates to a single-threaded
sequence with the value at i replaced with x. Raises
val inject :
(α stseq * (int * α) Seq.t) → α stseq
(inject (s, u))
evaluates to a single-threaded sequence with
updates given by u. If there are duplicate indices in u, the last one
is written and the others are ignored.
Raises Range
if any indices are out
of bounds.