# complement 函数

某个列表中不在其他任何列表里的元素。

## 怎么写

### complement(all, others, ...)

**all**

从中取元素的列表。接受一个列表。

**others**

要排除的元素列表。接受一个列表。

## 示例

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

  `complement([1, 2, 3], [2])`

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

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

## 相关函数

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

  由某个值的若干副本组成的列表。
- [apply](https://zh.hilberon.com/library/apply)

  把表达式的头部或列表的括号替换为函数。
- [count](https://zh.hilberon.com/library/count)

  列表中有多少个元素等于某个值。
- [append](https://zh.hilberon.com/library/append)

  在末尾添加一个元素后的列表。
- [dimensions](https://zh.hilberon.com/library/dimensions)

  列表或矩阵的大小，逐层给出。
- [accumulate](https://zh.hilberon.com/library/accumulate)

  列表的累计总和。

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