next up previous contents
Next: 5.6.2 Let Calls Up: 5.6 Local Call Previous: 5.6 Local Call

Self-Recursive Calls

 

Local call is used when a function defined by defun calls itself. For example:

(defun fact (n)
  (if (zerop n)
      1
      (* n (fact (1- n)))))
This use of local call speeds recursion, but can also complicate debugging, since  trace will only show the first call to fact, and not the recursive calls. This is because the recursive calls directly jump to the start of the function, and don't indirect through the symbol-function. Self-recursive local call is inhibited when the :block-compile argument to compile-file is nil (see section 5.7.3.)



Raymond Toy
Mon Jul 14 09:11:27 EDT 1997