MTS 8: LISP and SLIP in MTS
Page Revised January 1983 June 1976
(UNEVAL STACKID S) ____________________
UNEVAL allows the user to look back on the system stack and trace the
path that was followed by the system to get to its current position. It
may be used from an error form or break loop to restart from any given
point.
Each time EVAL is called internally, a block of information called an
EVAL block is stored on the stack. The EVAL block contains the form
which is to be EVALed, plus all relevant information needed to restart
at that level.
When the first argument to UNEVAL is a negative integer, it refers to
the Nth previous EVAL block on the stack. When the first argument to
UNEVAL is a positive integer, it refers to the Nth EVAL block on the
stack, beginning with the top-level form.
For example, if the program is in a break loop, and the user enters
| (UNEVAL -1), the last form sent to EVAL will be returned. This will be
(BREAK) if the program entered the break loop by calling BREAK directly,
or (DUMP N) if the break loop was entered as part of a dump operation.
(UNEVAL ignores its own EVAL block.)
If the first argument to UNEVAL is an expression S which is not an
integer, then the argument refers to the most recent call to EVAL for
which the CAR of the form to be evaluated was equal to S. For example,
if (UNEVAL ’ASSOC ) is evaluated, UNEVAL will return the most recent
outstanding EVAL-form which has ASSOC as its CAR.
If the first argument to UNEVAL is a number larger than the current
EVAL depth, or if it is a structure which is not equal to any function
specification on the stack, an error is generated.
Once UNEVAL identifies the correct EVAL block, the second argument
determines the action to be taken. If no second argument is given,
UNEVAL returns the form that was sent to EVAL at that level. Thus, a
call to UNEVAL with no second argument does not change the current level ___
of execution. If the second argument to UNEVAL is T, then execution is
restarted at that level. Thus, if (UNEVAL ’ASSOC T) is evaluated, the
system will exit from its current level, unbind all bindings back to the
point where ASSOC was called, and restart the call to ASSOC.
If the second argument to UNEVAL is anything other than T, then
execution is restarted at the indicated level, but the form given as the
second argument is substituted for the form which was originally sent to
EVAL. Thus, if the user evaluates (UNEVAL -4 ’(APPEND X Y)), the system
will unbind to the fourth previous EVAL block, and will then proceed to
evaluate (APPEND X Y) in place of the form which was originally given.
Note: The user should be aware that unbinding to a previous LISP
level restores only the values of variables bound in LAMBDA or PROG
60 LISP

MTS 8: LISP and SLIP in MTS
June 1976
expressions, and will not restore altered data structures, property-
lists, or VALUEs of free variables changed via SET or SETQ.
(GETFN FN) __________
GETFN allows the user to inspect the function definition associated
with a form. GETFN will consider its argument as a function specifica-
tion, and will simulate the action of EVAL in determining how to apply
it. If FN is a LAMBDA or LABEL expression, then the value returned from
GETFN is FN itself. If FN is an atom which is currently defined as a
SUBR, FSUBR, or NSUBR, then the PVAL associated with the SUBR, FSUBR, or
NSUBR indicator is returned as the value of GETFN. (This PVAL will be
generally be a SUBR or ARRAY type atom.)
If FN is an atom which is currently defined as an EXPR and the PVAL
associated with the EXPR property is a LAMBDA-expression, then the
LAMBDA-expression is the value returned from GETFN.
If FN is an atom which is currently defined as an EXPR but the PVAL
associated with the EXPR property is not a LAMBDA-expression, then the
PVAL will be substituted for FN and the search will continue.
If FN is an atom without a SUBR or EXPR type function definition, or
if FN is any other S-expression, then FN is EVALed, its value is
substituted for itself, and the search continues.
GETFN generates an error if it encounters an atom with no function
definition whose value is itself or *UNDEF*.
For example,
(GETFN ’(LAMBDA (X) X) (LAMBDA (X) X)
(GETFN ’CAR) = * .
(DEFUN EX (X Y) (CONS X Y)) = EX
(SETQ A EX) = EX
(GETFN ’A) = (LAMBDA (X Y) (CONS X Y))
The SUBR atom will be printed as an asterisk, but it may be dumped,
compared to other addresses, or transferred to the PLISTs of other
atoms. This example assumes A has no function definition on its PLIST.
(DISPLAY STACKID B,F,L A) _____________________________
The DISPLAY function allows the user to locate a position on the
stack with reference to an EVAL block, and then display one of the
following:
LISP 61
Previous Page Next Page