# Defining a sequence or a list: seq[ ] ()

### 5.39.1 Defining a sequence or a list: seq[ ] ()

Recall (see Section 4.3.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.

Input:

a,b,c,d

or:

(a,b,c,d)

or:

seq[a,b,c,d]

Output:

a,b,c,d

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

#### Examples.

- Input:
  [1,2,5]
  Output:

  ⎡ ⎣ | 1,2,5 | ⎤ ⎦

- Input:
  []
  (to create the empty list).
  Output:

  ⎡ ⎣ | ⎤ ⎦

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 5.44). Lists may be used to represent vectors (lists of coordinates), matrices, or univariate polynomials (lists of coefficients by decreasing order, see Section 5.27.1).

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

See Section 5.40 for some commands only for lists.