API Reference¶
The following symbols are exported by the LIVE-CELLS package.
- Macro (defcell name value-form)¶
Define a global cell identified by
NAME.This macro defines a cell identified by
NAMEwith its value computed byVALUE-FORM. The value of the cell can be referenced by the symbolNAMEfollowing theDEFCELLform.If
VALUE-FORMis a constant, byCONSTANTP, a mutable cell is defined which can have its value set directly usingSETForSETQon the symbolNAME.If
VALUE-FORMis not a constant a computed cell is created.Acomputed cell may reference one or more argument cells inVALUE-FORMor a function called during the evaluation ofVALUE-FORM. When the values of any of the argument cells change, the value of the computed cell is recomputed by evaluatingVALUE-FORMagain. The referenced argument cells are determined automatically when theVALUE-FORMis evaluated.This macro creates a cell definition that is visible globally to all forms unless it is lexically shadowed by a definition with the same
NAMEusingCELL-LET. Note that despite being visible globally, the cell definition is still lexically scoped and not dynamically scoped like global variables defined withDEFVARorDEFPARAMETER.
- Macro (live &body forms)¶
Define a live block consisting of
FORMS.The
FORMSare evaluated once when theLIVEform is first evaluated, after which they are evaluated again whenever the values of the cells referenced by them change. Cells may be referenced either directly inFORMSor by a function called during the evaluation ofFORMS.Returns a function which when called, stops the live block. Once stopped the live block will no longer be called when the values of the referenced cells change.
- Macro (cell-let (&rest bindings) &body body)¶
Define cells that are visible only to the forms in
BODY.BINDINGSis a list of cell bindings to establish, similar toLET*. Each item inBINDINGSis a list of the form(NAME VALUE-FORM)
where
NAMEis the symbol identifying the cell andVALUE-FORMis the value form of the cell. The cell can then be referenced within the forms inBODYby the symbolNAME.The cells defined in
BINDINGSlexcially shadow those in the environment defined withDEFCELLor by an enclosingCELL-LETform. LikeLET*and unlikeLET, each cell definition may reference the cells defined earlier in the sameCELL-LET.The forms in
BODYare evaluated in an implicitPROGN. The value returned by the last form is returned by theCELL-LETform.
- Macro (batch &body forms)¶
Batch assignments to the values of mutable cells.
The forms in
FORMSare evaluated, in an implicitPROGN, with mutable cell assignment batching in effect. This means that when the value of a mutable cell is set bySETFwithin the dynamic extent of theBATCHform, the observers of the cell are only notified after the last form inFORMSis evaluated, or theBATCHform is exited by a non-local exit such as byRETURN-FROM. The effect of this is that the cells appear to have their values changed simultaneously.Note
When a BATCH form is nested in the dynamic extent of another BATCH form, the nested BATCH form has no effect other than to evaluate FORMS. The observers of the cells are only notified when exiting the outermost BATCH form.
Returns the value of the last form in
FORMS.
- Function (none &optional default-value)¶
Stop the computation of a cell’s value.
When this function is called within the value form of cell, the computation of the cell’s value is stopped, the value form is exited and the cell’s current value is preserved.
If this function is called while computing the initial value of a cell, the value of the cell is set to
DEFAULT-VALUE.The symbol-macro
NONEis a synonym for(NONE).This function works by signaling a
STOP-COMPUTATIONcondition, which is then handled by the cell. It is important that this condition is not handled by the value form of the cell, otherwise this function will have no effect.