# slot 函数

无名函数的第 n 个参数：在 function(body) 中，slot(1) 是第一个。

## 怎么写

### slot(n)

导数 sin' 写作 function(cos(slot(1)))。

**n**

第几个参数，从 1 开始。接受一个整数。

## 示例

- $\displaystyle \operatorname{map}(\#1^{2} \, \&, \left[ 1, 2, 3 \right]) = \left[ 1, 4, 9 \right]$

  `map(function(slot(1)^2), [1, 2, 3])`

  在求解器中，`map(function(slot(1)^2), [1, 2, 3])` 的结果是 `[1, 4, 9]`。

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

## 示例中用到的函数

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

  对列表中的每个元素应用一个函数。
- [function](https://zh.hilberon.com/library/function)

  没有名字的函数；也可写作 x => body。

## 相关函数

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

  反复应用代入规则，直到不再变化。
- [set_delayed](https://zh.hilberon.com/library/set_delayed)

  定义函数；也可写作 f(x) := body。
- [subtract_from](https://zh.hilberon.com/library/subtract_from)

  就地从一个变量中减去一个值，并返回新值。
- [set](https://zh.hilberon.com/library/set)

  给名称赋值；也可写作 name := value。
- [times_by](https://zh.hilberon.com/library/times_by)

  就地把变量乘以一个值，并返回新值。
- [release_hold](https://zh.hilberon.com/library/release_hold)

  对已保持的表达式求值。

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