Previous Up Next

5.43.10  The right and left portions of a list: right, left

The right command takes two arguments, a list and an integer n.
right returns the last n elements of the list.
Input:

right([0,1,2,3,4,5,6,7,8],4)

Output:

[5,6,7,8]

Similarly, left returns the first part of a list.
Input:

left([0,1,2,3,4,5,6,7,8],3)

Output:

[0,1,2]

Previous Up Next