Previous Up Next

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

Recall (see Section 5.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 5.3.3) a list (or a vector) is a sequence of elements separated by commas delimited with [ and ].


Examples.


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

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

See Section 6.40 for some commands only for lists.


Previous Up Next