This section shows you how to perform simple traces.
facinto the listener:
(defun fac (n)
(if (= n 1) 1
(* n (fac (- n 1)))))
The following trace output appears in the listener.
0 FAC > (3)
1 FAC > (2)
2 FAC > (1)
2 FAC < (1)
1 FAC < (2)
0 FAC < (6)
Upon entry to each traced function call, trace prints the following information:
Each call is indented according to the level of tracing for the call.
Upon exit from each call, the same information is produced: The
symbol denotes entry to a function, and the
symbol denotes exit from it.
Output produced in this way is always sent to a special stream,
, which is either associated with the listener, or with background output. You can give other expressions to be sent to this stream, in addition to the arguments and results of a function.
Calling trace with no arguments produces a list of all the functions currently being traced. In order to cease tracing a function the macro
should be called with commands. All tracing can be removed by calling
with no arguments.
CL-USER 5 > (untrace fac)
CL-USER 6 > (fac 4)
CL-USER 7 >