We invoke a function within another function, method or factory by creating an S-expression that begins with the function name and is followed by a sequence of input arguments. By using the mapping symbol
(->) we can specify the output variables that are assigned in the function evaluation.
(Float32 value) (Sys.Maths.F32.Sin 0 -> value)
The above code creates a 32-bit floating point variable called value, and assigns the sine of zero to it.
A function that maps to multiple output values uses a sequence of variable names following the mapping symbol.
(Float32 sinX) (Float32 cosX) (Sys.Math.F32.SinCos 0 -> sinX cosX)
If a function only returns a single output, the mapping symbol and output can be eliminated and the
S-expression is deemed to evaluate to the output and can be used in an assignment expression. The
output is then called a return value of the function.
(Float32 sinX = (Sys.Math.F32.Sin 0))
A function that takes no input and evaluates to a single output is called a get-accessor and can be invoked without using parenthesis.
(function Pi -> (Float32 pi) : (pi = 3.14159)) (Float32 pi = Pi) // This evaluates Pi, because function Pi is a get-accessor.