### 6.1.1 Defining a sequence or a list

Recall (see Section 3.2.1) that a sequence is represented by a sequence of elements separated by commas, either without delimiters, with parentheses (( and )) as delimiters, or with seq[ and ] as delimiters.

#### Examples

a,b,c,d

or:

(a,b,c,d)

or:

seq[a,b,c,d]

a,b,c,d |  |  |  |  |  |  |  |  |  |

Similarly (see Section 3.2.3) a list (or a vector) is a sequence of elements separated by commas delimited with [ and ].

#### Examples

[1,2,5]

| ⎡ ⎣ | 1,2,5 | ⎤ ⎦

To create an empty list, input:

[]

| ⎡ ⎣ | ⎤ ⎦

##### Remarks.

Lists have more structure than sequences. For example, a list can contain lists (for example, a matrix is a list of lists of the same size, see Section 14.2). Lists may be used to represent vectors (lists of coordinates), matrices, or univariate polynomials (lists of coefficients by decreasing order, see Section 11.1.1).

Sequences, on the other hand, are flat. An element of a sequence cannot be a sequence.

See Section 6.3 for some commands only for lists.