:before
list of forms
If non-nil, the list of forms is evaluated on entry to the function being traced. The forms are evaluated and the results printed after the arguments to the function.
Here is an example of its use.
*traced-arglist*
is bound to the list of arguments given to the function being traced. In this example, it is used to accumulate a list of all the arguments to
fac
across all iterations.
args-in-reverse
as follows:
(setq args-in-reverse ())
fac
function used earlier, set the value of
:before
to the following list:
((push (car *traced-arglist*) args-in-reverse))
(fac 3)
After evaluating this form,
args-in-reverse
has the value
(1 2 3)
, that is, it lists the arguments which
fac
was called with, in the reverse order they were called in.
:after
list of forms
If non-nil, this option evaluates a list of forms upon return from the function to be traced. The forms are evaluated and the results printed after the results of a call to the function.
This option is used in exactly the same way as
:before
. For instance, using the example for
:before
as a basis, create a list called
results-in-reverse
, and set the value of
:after
so that
(car *traced-results*)
is pushed onto this list. After calling
fac
,
results-in-reverse
contains the results returned from
fac
, in reverse order.
Note also that
*traced-arglist*
is still bound.
LispWorks User Guide and Reference Manual - 21 Dec 2011