Writing a function or procedure in Lisp can be more convenient that the creation of a visual program. Lisp Function boxes are abstractions defined in Lisp textually. Like visual abstractions
they can be internal to a patch – red
or defined globally in the environment and workspace –blue.
To create a new Lisp function in a patch you can either
A new box will appear, with one output. It doesn't have a default input. This box behaves externally as a red patch box — internal abstraction —. |
To create a
global Lisp Function
like a patch or a maquette, use the File / New Function
menu item in the workspace or folder windows.
The new Lisp function created here can be used in several locations, just like a blue patch. All its representations will refer to this same master function.
The box created will (externally) behave as a blue patch box.
Red and blue Lisp functions can also be converted with the standard patch conversion procedures.
To globalize a red lisp function, drag it to the workspace. The function will be converted automatically.
To rename the function, rename it from the workspace.
To internalize a blue lisp function, select it and press |
Double click a Lisp Function box to edit its contents. The window that opens is similar to a Lisp editor.
The function must be written as a lambda expression with a given number of arguments. The editor provides a default basic edition pattern showing the components of such lambda expression. |
When the Lisp editor of the box is closed, the number of inputs is updated according to the number of arguments of the function, if arguments have been added or deleted.
Lisp functions can have only one output, which corresponds to the value returned by the Lambda expression.