The ST_SEQUENCE signature

« 210 Library Documentation

Overview

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.

Interface

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

Substructures

structure Seq : SEQUENCE
The Seq substructure defines the underlying sequence type to and from which single-threaded sequences can be converted.

Types

type α t
The abstract single-threaded sequence type.
type α stseq = α t
An alias for α t, for readability.

Exceptions

exception Range
Range is raised whenever an invalid index into a single-threaded sequence is used.

Values

val fromSeq : α Seq.t → α stseq
Return the single-threaded sequence representation of a sequence.
val toSeq : α stseq → α Seq.t
Return the sequence representation of a single-threaded sequence.
val nth : α stseq → int → α
(nth s i) evaluates to $s_i$, the $i^{th}$ 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 Range if $i$ is out of bounds.
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.