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
f(x) := x^2 + 1; f(3)In the solver,
Open in the solverf(x) := x^2 + 1; f(3)gives10.
Related functions
- set
Assign a value to a name; also written name := value.
- slot
The n-th argument of a function with no name: inside function(body), slot(1) is the first.
- subs_repeated
Apply substitution rules again and again until nothing changes.
- release_hold
Evaluate an expression that was held.
- subtract_from
Subtract a value from a variable in place and return the new value.
- pre_increment
Add 1 to a variable in place and return the new value.