# set_delayed function

Define a function; also written f(x) := body.

## How to write it

### set_delayed(pattern, body)

**pattern**

The function with its parameters, such as f(x). Takes an expression.

**body**

What it computes, using the parameters. Takes an expression.

## Examples

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

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

  In the solver, `f(x) := x^2 + 1; f(3)` gives `10`.

  [Open in the solver](https://hilberon.com/?q=f%28x%29%20%3A%3D%20x%5E2%20%2B%201%3B%20f%283%29)

## Related functions

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

  Assign a value to a name; also written name := value.
- [slot](https://hilberon.com/library/slot)

  The n-th argument of a function with no name: inside function(body), slot(1) is the first.
- [subs_repeated](https://hilberon.com/library/subs_repeated)

  Apply substitution rules again and again until nothing changes.
- [release_hold](https://hilberon.com/library/release_hold)

  Evaluate an expression that was held.
- [subtract_from](https://hilberon.com/library/subtract_from)

  Subtract a value from a variable in place and return the new value.
- [pre_increment](https://hilberon.com/library/pre_increment)

  Add 1 to a variable in place and return the new value.

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