# riffle 函数

在元素之间插入某个值后的列表。

## 怎么写

### riffle(list, x)

**list**

列表。接受一个列表。

**x**

要插入的值。接受一个表达式。

## 示例

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

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

  在求解器中，`riffle([1, 2, 3], 0)` 的结果是 `[1, 0, 2, 0, 3]`。

  [在求解器中打开](https://zh.hilberon.com/?q=riffle%28%5B1%2C%202%2C%203%5D%2C%200%29)

## 相关函数

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

  列表的元素向左移动，开头的元素移到末尾。
- [reverse](https://zh.hilberon.com/library/reverse)

  逆序排列的列表。
- [rotate_right](https://zh.hilberon.com/library/rotate_right)

  列表的元素向右移动，末尾的元素移到开头。
- [rest](https://zh.hilberon.com/library/rest)

  去掉第一个元素后的列表。
- [select](https://zh.hilberon.com/library/select)

  列表中满足某个测试的元素。
- [replace_part](https://zh.hilberon.com/library/replace_part)

  把某个位置上的部分替换后的列表；写作 position -> value。

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