`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-
The
`Seq`

substructure defines the underlying sequence type to and from which single-threaded sequences can be converted.

`type`

**α t**- The abstract single-threaded sequence type.
`type`

**α stseq**= α t- An alias for
`α t`

, for readability.

`exception`

**Range**`Range`

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

`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$. RaisesRange 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.