previous chapterthe pico pagenext chapter


Function application

Any function bound to a variable in the current dictionary is candidate to be applied:

name(expression,...)

An application identifies the function by name and further specifies a number of arguments separated by comma's and delimited by ordinary parentheses. Any valid expression can be used as argument; their number should correspond to the number of parameters of the function bound to the variable named in the application.

Consider as an example the following function application:

f(1+2,3,2*2)

which our intuition tells us should produce the value 21. In the next chapter the mechanism of function application will be described formally; for the time being we will limit ourselves to an informal introduction.

Function application starts by looking up the function name in the dictionary; if it isn't found or if its value is different from a function, an error is generated. In the other case the values of arguments are computed and temporarily -that is for the duration of the function application- bound to the corresponding parameters, after which the value of the prescription is computed and returned.

In the preceding transcript various transactions involving function application are illustrated. Note that it is impossible to apply a function unless it has been properly defined with the correct number of parameters.


previous chapterthe pico pagenext chapter