### 5.40.2 Get an element or a sub-list of a list : at []

#### Get an element

The n-th element of a list l of size s
is addressed by l[n] where n is in [0..s−1] or [1..s].
The equivalent prefixed function is
at, which takes as argument a list and an integer n.

at returns the element of the list at index n.

Input :

[0,1,2][1]

or :

at([0,1,2],1)

Output :

1

#### Extract a sub-list

If l is a list of size s, l[n1..n2] returns the list
extracted from l containing the elements of indexes n_{1} to n_{2}
where 0 ≤ n_{1}≤ n_{2} < s (in Xcas syntax mode) or
0 < n_{1}≤ n_{2} ≤ s in other syntax modes.
The equivalent prefixed function is
at with a list and an interval of integers (n1..n2)
as arguments.

See also : mid, section 5.40.3.

Input :

[0,1,2,3,4][1..3]

or :

at([0,1,2,3,4],1..3)

Output :

[1,2,3]

Warning

at can not be used for sequences, index notation
must be used, as in (0,1,2,3,4,5)[2..3].