# Prepending an element at the beginning of a list: prepend

### 5.40.12 Prepending an element at the beginning of a list: prepend

The prepend command adds an element to the beginning of a list.

- prepend takes two arguments:
  - x.
  - L, a list.
- prepend(x,L) returns a list containing x as the first element followed by the elements of L.

#### Examples.

- Input:
  prepend([3,4,2],1)
  Output:

  ⎡ ⎣ | 1,3,4,2 | ⎤ ⎦

- Input:
  prepend([1,2],[3,4])
  Output:

  ⎡ ⎣ | ⎡ ⎣ | 3,4 | ⎤ ⎦ | ,1,2 | ⎤ ⎦