Obtaining left and right portions of a list

### 6.3.6 Obtaining left and right portions of a list

The left and right commands find the left and right parts of a list. (See Section 5.2.4, Section 8.2.3, Section 6.5.1, Section 6.6.2, Section 9.3.4 and Section 9.3.5 for other uses of left and right.)

- left takes two arguments:
  - L, a list.
  - n, a positive integer.
- left(L,n) returns the first n elements of L.
- right takes two arguments:
  - L, a list.
  - n, a positive integer.
- right(L,n) returns the last n elements of L.

#### Examples

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

| ⎡ ⎣ | 0,1,2 | ⎤ ⎦

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

| ⎡ ⎣ | 5,6,7,8 | ⎤ ⎦