The compound data types are used to build new types as aggregates of other types, including other compound types. (Note that List and Array are compound types, as well, but contain only a single type of data.) Structure, Sequence and Function all contain a list of BaseType objects. However, they have different semantics; a Structure is a simple aggregate; nothing other than aggregation is implied, while Sequence and Function define templates for relational objects. A Grid combines several Array objects so that nonlinear values may be applied to the indices of an array.
Consider a Sequence named S, where each instance is called s:
s_0 0 s_0 1 . s_0 n s_1 0 s_1 1 . s_0 n . . . . s_i 0 s_i 1 . s_i n . . .
Every instance s_i of S has the same number, order, and class of variables. A Sequence implies that each of the n variables is related to each other in some logical way. Because a Sequence has several values for each of its variables it has an implied state, or position in the sequence, in addition to the instance data values.
| Name | Age | Weight |
| James | 32 | 165 |
| Charlie | 7 | 65.4 |
| Bob | 10 | 80 |
James, 32, 165, s_1 is Charlie,
7, 65.4, .... The data in the table might have the
following Sequence declaration:
Sequence {
Str name;
Int32 age;
Float64 weight;
} people;
Grid =
| 32.0 | 31.5 | 31.1 | 30.8 | 29.2 |
| 32.3 | 31.8 | 31.4 | 30.9 | 29.8 |
| 32.9 | 32.3 | 31.8 | 29.7 | 30.2 |
| 32.3 | 31.8 | 31.5 | 30.7 | 29.9 |
| 1.2 | 1.4 | 1.8 | 3.9 | 4.5 |
| 67.8 | 68.7 | 92.3 | 95.2 |
In figure 1.2.4, the grid element indicated by
Grid[2][3] corresponds to N[2] and M[3], or N =
92.3 and M = 3.9 respectively. The element has a value of 29.7.