Lists define arbitrary sequences of CUE values, and can be closed or open. List members are called elements.

A closed list statically defines its length each and every time its elements are specified.

Open lists may contain some predefined elements, followed by `...` and an optional value that constrains any elements that follow. Open lists permit additional elements to be specified elsewhere, after the predefined elements. Both the predefined and additional elements may be constrained.

file.cue
``````// A is an open list with 3 predefined elements.
// Any additional elements must be ints.
A: [1, 2, 3, ...int]

// B is a closed list with 4 elements which is
// compatible with A's constraints.
B: [1, 2, 3, 4] & A

// C is a closed list with 3 elements which is
// compatible with A's constraints.
C: [1, _, _] & A
C: [_, 2, _] // 3 elements must be specified on
C: [_, _, 3] // each and every definition.

// D is an open list containing at least 2 ints,
// and is compatible with A's constraints.
D: [int, int, ...int] & A

// Closed lists with different lengths don't unify.
unifyFailBC: B & C
// Element type mismatches prevent unification.
unifyFailA: A & [1, 2, 3, "4"]

// E is built up incrementally as an example.
// E has identical constraints to A.
E: [...] // No type information; list is open.
E: [_, _, _, ...] // There are at least 3 elements.
E: [...int] // All elements are ints.
E: [1, ...] // Element 1 is made concrete.
E: [_, 2, ...] // Element 2 is made concrete.
E: [_, _, 3, ...] // Element 3 is made concrete.``````
TERMINAL
``````\$ cue eval -i file.cue
A: [1, 2, 3]
B: [1, 2, 3, 4]
C: [1, 2, 3]
D: [1, 2, 3]
unifyFailBC: _|_ // unifyFailBC: incompatible list lengths (3 and 4) (and 2 more errors)
unifyFailA: [1, 2, 3, _|_, // unifyFailA.3: conflicting values "4" and int (mismatched types string and int)
]
E: [1, 2, 3]``````