`IFSeqSig.IFSEQ_BASIC`

A signature for implicit finite sequences.

These sequences are implicit, which means that they are not explicitly represented in memory as actual sequences of elements; instead, they are described by a data structure which contains enough information to produce an arbitrary element upon request. This design decision imposes some constraints on the operations that can be efficiently supported; for instance, `filter`

is not supported.

This signature forms an applicative functor.

Constructors.

`val empty : 'a seq`

`empty`

is a sequence of length zero.

`val zero : 'a seq`

`zero`

is a synonym for `empty`

.

`val singleton : 'a -> 'a seq`

`singleton x`

is a sequence of length one whose single element is `x`

.

`val one : 'a -> 'a seq`

`one`

is a synonym for `singleton`

.

`product s1 s2`

is the Cartesian product of the sequences `s1`

and `s2`

. Its length is the product of the lengths of `s1`

and `s2`

. The first pair component is considered most significant.

`map phi s`

is the image of the sequence `s`

through the function `phi`

. If the user wishes to work with sequences of pairwise distinct elements, then `phi`

should be injective. If furthermore the user wishes to work with sequences that enumerate all elements of a type, then `phi`

should be surjective.

`val up : int -> int -> int seq`

`up i j`

is the sequence of the integers from `i`

included up to `j`

excluded.

`get s i`

is the `i`

-th element of the sequence `s`

. The index `i`

must be comprised between zero included and `length s`

excluded.

`val foreach : 'a seq -> ('a -> unit) -> unit`

`foreach s k`

iterates over all elements of the sequence `s`

. Each element in turn is passed to the loop body `k`

.

`val to_seq : 'a seq -> 'a Stdlib.Seq.t -> 'a Stdlib.Seq.t`

`to_seq s k`

produces an explicit representation of the sequence `s`

as a sequence in the sense of OCaml's standard library module `Seq`

. This sequence is prepended in front of the existing sequence `k`

.