The "lambda" mode plays a major part in the design of complex programs, and is used in various types of configurations. It is a specific procedure that allows boxes to be identified as "function objects". Then, the box won't perform a calculation and yield a result, but will yield itself as a function object when the evaluation takes place. | ![]() The om+ box doesn't return the result of an addition, but an "anonymous" function. |
Some functions wait for arguments that are not as simple as numbers or lists. Functions called higher-order functions have some arguments, called functional arguments , which are function objects themselves. A function has to be set on "lambda" mode to be used as a functional argument, and can be then called a "lambda function".
For instance, apply is a higher-order Lisp function that applies a functional argument, which must be a function, to a second argument, which must be the elements of a list. Here, apply applies + to a list of four numbers. | ![]() |
To set a box on "lambda" mode, select it, press b
and click twice on the upper left cross. A small λ letter icon appears.
In practice, functional arguments are used in two main configurations :
as an argument applied to one or more other arguments by the higher-order function
as a test function that will determine the behaviour of a higher-order function.
![]() | The argument can be specified with a standard function box on "lambda" mode, and is applied to the other arguments of the higher-level function, as shown in the first example. |
The argument can also be specified by a simple function name in a data box. | ![]() |
Some functions are more specifically dedicated to the application of lambda functions : |
|
Some functions have a default "test" argument that is generally used for determining which items, among a wider set of items, the function operates upon. It is sometimes necessary to redefine this test argument so that the function can operate upon other types of items. A test function can hence be compared to a predicate1, and is connected to the "test" argument of a higher-order function.
A predicate verifies the property of a thing or a relation between two things. It has two possible answers : "true", and "false", that is, "t", or "nil" in Lisp.