Record types with a fixed number of slots can be defined with the datatype construct. For example,
defines a record with two slots both which must contain a floating-point number. Defining a record also defines a corresponding function that is used to construct the record. For example,
Elements of a record can be accessed using pattern matching in the let construct. For example,
let complex(real,imaginary) = ain real;
will remove the real part of the variable a (assuming it is kept in the first slot). More details on pattern matching are given in the next section.
As with functions, records can be parameterized based on type-variables. For example, complex could have been defined as: