Skip to main content

Composite types

Tuple

A tuple is a fixed-length list of values of different types.

For example:

const p = (0, "a string");

p is a pair of a nat and string values, typed nat * string.

Find more information in the Declaration section.

Below is the list of tuple-related instructions and operators.

Instructions


Assigns a value to a tuple dimension


Increments a tuple dimension


Decrement a tuple dimension


Multiplies a tuple dimension


Divides a tuple dimension


Applies logical conjonction to a tuple dimension


Applies logical disjunction to a tuple dimension


Operators


Accesses a tuple dimension


Record

A record is fixed-length list of named values of different types.

For example, a person record is declared as follows:

record person {
first : string;
last : string;
birth : date;
}

Find more information in the Declaration section.

A literal for the person record is for example:

const p = {
first = "Albert";
last = "Michelson";
birth = 1852-12-19
};

Below is the list of record-related instructions and operators.

Instructions


Assigns a value to a field record


Increments a field record


Decrement a field record


Multiplies a field record


Divides a field record


Applies logical conjonction to a field record


Applies logical disjunction to a field record


Operators


Copies a record with field assignments


Accesses a record's field


Enum

An enumeration is an union of named label types.

For example, float is either Pos, Neg or Zero:

enum float =
| Pos<nat * nat>
| Neg<nat * nat>
| Zero

Find more information in the Declaration section.

Literals for the sign enumeration are:

const p = Pos((6, 5));
const n = Neg((3,2));
const z = Zero;

Below is the list of enumeration-related instructions and operators.

Instructions


Controls execution flow based on enumeration value


Operators


Controls expression value based on enumeration value