I am trying to learn Common Lisp with the book Common Lisp: A gentle introduction to Symbolic Computation. In addition, I am using SBCL, Emacs, and Slime.
In the end of chapter 8, the author presents the debugger as one of the great tools for lisp programming. Then, to showcase it he uses the break command inside a factorial-like function definition:
(defun fact-debugging (n)
(cond ((zerop n) (break "N is zero."))
(t (* n (fact-debugging (- n 1))))))
After calling the function in the REPL with:
CL-USER> (fact-debugging 4)
I get the the control stack. . I am specially curious about the backtrace part:
N is zero.
[Condition of type SIMPLE-CONDITION]
Restarts:
0: [CONTINUE] Return from BREAK.
1: [RETRY] Retry SLIME REPL evaluation request.
2: [*ABORT] Return to SLIME's top level.
3: [ABORT] abort thread (#<THREAD "repl-thread" RUNNING {10024B9BC3}>)
Backtrace:
0: (FACT-DEBUGGING 1)
1: (FACT-DEBUGGING 2)
2: (FACT-DEBUGGING 3)
3: (FACT-DEBUGGING 4)
4: (SB-INT:SIMPLE-EVAL-IN-LEXENV (FACT-DEBUGGING 4) #<NULL-LEXENV>)
5: (EVAL (FACT-DEBUGGING 4))
I can understand all stack frames except for the number 4: (SB-INT...
Interestingly enough the author does not get such a message. He gets something lighter:
Hence, I would like to ask:
1 - Why does that stack frame happen?
2 - Why it happens after eval and before the stack-frame of (fact-debugging 4)?
3 - What does it actually mean? It is full of unseen terms like LEXENV or #<NULL LEXENV>.
