# 匿名函数（Anonymous function，function）

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

## 怎么写

### function(parameters, body)

**parameters**

参数，或放在括号中的参数列表。接受一个变量或变量列表。

**body**

要求值的表达式。接受一个表达式。

## 示例

- $\displaystyle (x \mapsto x^{2})(3) = 9$

  `(x => x^2)(3)`

  在求解器中，`(x => x^2)(3)` 的结果是 `9`。

  [在求解器中打开](https://zh.hilberon.com/?q=%28x%20%3D%3E%20x%5E2%29%283%29)

## 相关函数

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

  由测试条件选出的值。
- [evaluate](https://zh.hilberon.com/library/evaluate)

  对表达式求值，即使它本应保持不计算。
- [increment](https://zh.hilberon.com/library/increment)

  将变量原地加 1，并返回它的旧值。
- [divide_by](https://zh.hilberon.com/library/divide_by)

  将变量就地除以一个值，并返回新的值。
- [indicator](https://zh.hilberon.com/library/indicator)

  把条件表示为数：为真时为 1，为假时为 0。
- [decrement](https://zh.hilberon.com/library/decrement)

  将变量就地减 1，并返回它原来的值。

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