perform [Macro]
Purpose
The perform macro is used to create tasks. A task is the application of a specific Loom action (implemented as a set of methods) to one or more objects. The perform macro executes the task immediately, rather than queuing it for later execution (as schedule does).
Syntax
perform (actionName &rest arguments) &key returnOption
Arguments
The actionName argument is the name of the action which is to be applied to arguments. The procedure actually performed depends on which of the methods attached to actionName have their situation patterns satisfied by arguments.
The arguments argument contains zero or more variables or constants. Keyword arguments are supported, but optional and rest arguments are not.
The returnOption argument specifies what kind of value the action should return. The options are:
- The :value option indicates that perform should return the value of the last method that was applied, or nil if there were no applicable methods.
- The :success-p option indicates that perform should return t if (1) one or more methods were applied and none of them called fail, or (2) there were no applicable methods and the :no-op missing-method option was supplied in the definition of actionName. Otherwise, nil should be returned.
- The :task option indicates that a task should be created and immediately performed, and that perform should return the completed task object.
If returnOption is not supplied, it defaults to :value.
Value
The return value of perform is determined by the returnOption argument (see above).
Remarks
Tasks may be performed as a result of production firings, as well as explicit calls to perform.
Examples
(perform (weigh-box box)) ==> 44
(perform (inspect-box box shipper) :return :success-p) ==> T
(perform (notify-shipper (fi Acme)) :return :task) ==>
|TASK|(NOTIFY-SHIPPER |I|ACME)
See Also
Last modified: Jun 1 1995