Trace keyword
:before list of forms
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 tofac 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 whichfac was called with, in the reverse order they were called in.
Trace keyword
:after list of forms
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. :before. For instance, using the example for:before as a basis, create a list calledresults-in-reverse, and set the value of:after so that(car *traced-results*) is pushed onto this list. After callingfac,results-in-reverse contains the results returned fromfac, in the reverse order they were called in. *traced-arglist* is still bound as well.