# set_delayed 函数

定义函数；也可写作 f(x) := body。

## 怎么写

### set_delayed(pattern, body)

**pattern**

带参数的函数，例如 f(x)。接受一个表达式。

**body**

它用这些参数计算什么。接受一个表达式。

## 示例

- $\displaystyle f(x) := x^{2}+1;\; f(3) \; 10$

  `f(x) := x^2 + 1; f(3)`

  在求解器中，`f(x) := x^2 + 1; f(3)` 的结果是 `10`。

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

## 相关函数

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

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

  无名函数的第 n 个参数：在 function(body) 中，slot(1) 是第一个。
- [subs_repeated](https://zh.hilberon.com/library/subs_repeated)

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

  对已保持的表达式求值。
- [subtract_from](https://zh.hilberon.com/library/subtract_from)

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

  把变量原地加 1 并返回新值。

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