CreateFunction
Creates a function.
Syntax
-
CreateFunction(x, expr)
-
x
is a symbol -
expr
is an expression, optionally containingx
-
-
CreateFunction(exprl([x1[, x2[, ...]]]), expr)
-
x1
,x2
, ... are symbols -
expr
is an expression, optionally containingx1
,x2
, ...
-
Description
The CreateFunction
function implements the ↦
operator used to create functions. Normally, this operator is used instead of the CreateFunction
function. See the article for ↦
for details and examples.
However, there is one situation when CreateFunction
might be useful in itself, and that is when you want to create a function that takes no arguments. To do this, the following syntax can be used:
CreateFunction(exprl(), expr)
Examples
f ≔ CreateFunction(exprl(), RandomInt(0, 100))
custom function
compute(f(), n, 1, 10)
47 15 15 95 29 6 86 6 26 87