Previous Up Next

6.39.6  Getting an element of a sequence or a list: [] [[]] at

The elements of a sequence have indices beginning at 0 in Xcas mode and 1 in other modes (see Section 3.5.2).

You can get the an element of index n of a sequence or list by following the sequence or list with [n] (see Section 5.3.4).
(Note that head(S) does the same thing as S[0].)


Examples.


For lists, the at command can also be used to get the element at a specific position.

Note. at cannot be used for sequences, since the second argument would be merged with the sequence.


Example.
Input:

[0,1,2][1]

or:

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

Output:

1

Previous Up Next