4.2 The Tracer
> (defun fact (n) (if (< n 1) 1 (* n (fact (1- n))))) FACTThe trace output contains the following information:> (trace fact) (FACT)
> (fact 4) 1 Enter FACT 4 | 2 Enter FACT 3 | 3 Enter FACT 2 | | 4 Enter FACT 1 | | 5 Enter FACT 0 | | 5 Exit FACT 1 | | 4 Exit FACT 1 | 3 Exit FACT 2 | 2 Exit FACT 6 1 Exit FACT 24 24
trace
. See description of trace
for more information.You can change the indentation, the printing of vertical bars, and the number of columns in the trace output by using the following variables, which are extensions to Common Lisp:
*max-trace-indentation* *trace-bar-p* *trace-columns-per-level*In addition, the variables
*debug-print-length*
and*debug-print-level*
control the length and level of printing within the trace output. When the tracing information for a function is being printed, the variable*print-level*
is bound to the value of the variable*debug-print-level*
, and the variable*print-length*
is bound to the value of the variable*debug-print-length*
. You can change the printing level and length by binding each of the variables*debug-print-level*
and*debug-print-length*
to a fixnum integer greater than or equal to 1. See Chapter 3, "Debugging Lisp Programs" for more information.
Generated with Harlequin WebMaker