Dynamic call to a function

call expression
(call expression arg1 arg2 ... opt1 opt2 ...)

Dynamically calls a function which is the result of expression. Required and optional arguments of the function can be passed to the call as optional arguments of the instruction.

Example:

to f1 :x op sqrt :x end
to f2 :x op exp :x end
to f3 :x op log :x end

repeat 3 [print (call func word "f repcount 2)]

Output:

1.4142135623731
7.38905609893065
0.693147180559945

See also:

Function as a value
$, func - get the function

Table of Content