# riffle function

A list with a value put between its elements.

## How to write it

### riffle(list, x)

**list**

The list. Takes a list.

**x**

The value to put between. Takes an expression.

## Examples

- $\displaystyle \operatorname{riffle}(\left[ 1, 2, 3 \right], 0) = \left[ 1, 0, 2, 0, 3 \right]$

  `riffle([1, 2, 3], 0)`

  In the solver, `riffle([1, 2, 3], 0)` gives `[1, 0, 2, 0, 3]`.

  [Open in the solver](https://hilberon.com/?q=riffle%28%5B1%2C%202%2C%203%5D%2C%200%29)

## Related functions

- [rotate_left](https://hilberon.com/library/rotate_left)

  A list with its elements moved to the left, the first ones going to the end.
- [reverse](https://hilberon.com/library/reverse)

  A list in reverse order.
- [rotate_right](https://hilberon.com/library/rotate_right)

  A list with its elements moved to the right, the last ones going to the front.
- [rest](https://hilberon.com/library/rest)

  A list without its first element.
- [select](https://hilberon.com/library/select)

  The elements of a list for which a test holds.
- [replace_part](https://hilberon.com/library/replace_part)

  A list with the part at a position replaced; write position -> value.

---
Source: https://hilberon.com/library/riffle
