Definition

### 5.43.1 Definition

A list (or a vector) is delimited by [ ], its elements must be separated by commas. For example, [1,2,5] is a list of three integers.

Lists can contain lists (for example, a matrix is a list of lists of the same size). Lists may be used to represent vectors (list of coordinates), matrices, univariate polynomials (list of coefficients by decreasing order).

Lists are different from sequences, because sequences are flat : an element of a sequence cannot be a sequence. Lists are different from sets, because for a list, the order is important and the same element can be repeated in a list (unlike in a set where each element is unique).

In Xcas output :

- vector (or list) delimiters are displayed as [],
- matrix delimiters are displayed as [],
- polynomial delimiters are displayed as ,
- set delimiters are displayed as .

The list elements are indexed starting from 0 in Xcas syntax mode and from 1 in all other syntax modes. To access an element of a list, follow the list with the index between square brackets.
Input:

L := [2,5,1,4]

Output:

[2,5,1,4]

Input:

L[1]

Output:

5

To access the last element of a list, you can put -1 between square brackets.
Input:

L[-1]

Output:

4

If you want the indices to start from in Xcas syntax mode, you can enter the index between double brackets.
Input:

L[[1]]

Output:

2