I am sorry that I appear to not have read the manual, but it was hard to decipher where and when to type the keywords like :step and :next and (declare (optimize (debug 3))). I went through the SBCL manual and the hyperspec for about 30 minutes, but I didn't find anything as clear as what Rammaren simply showed. I might be misusing terminology when I am talking about tail recursion... I just assumed that with multiple recursion like the simple Fibonacci function, it is still considered a tail recursive function. When I say cycle back to the top, I just meant to say to start the next cycle of recursion. There's probably a technically correct way to say this...
You can declaim it before any functions you want to step through.
I am not sure what you mean, but after perusing the hyperspec, I presume you are talking about having (declare (optimize (debug 3))) outside of the function and replace declare with declaim. Like this:
(declaim (optimize (debug 3)))
(defun test-step () (print 'a)(print 'b)(print 'c))
I tested it with another function without having to insert a declare expression again, so it seems to work...
Once again, I am grateful to you folks for being patient and so helpful.
(defun fibo (n) (declare (optimize (debug 3)))
(cond ((equal n 0) 1)
((equal n 1) 1)
(t (+ (fibo (- n 1)) (fibo (- n 2))))))
* (step (fibo 5))
; Evaluating call:
; (FIBO 5)
; With arguments:
; 5
1] :step
; Evaluating call:
; (EQUAL N 0)
; With arguments:
; 5
; 0
1] :next
; Evaluating call:
; (EQUAL N 1)
; With arguments:
; 5
; 1
1] :next
; Evaluating call:
; (- N 1)
; With unknown arguments
0] :next
; Evaluating call:
; (FIBO (- N 1))
; With arguments:
; 4
1] :next
; Evaluating call:
; (- N 2)
; With unknown arguments
0] :next
; Evaluating call:
; (FIBO (- N 2))
; With arguments:
; 3
1] :next
; Evaluating call:
; (+ (FIBO (- N 1)) (FIBO (- N 2)))
; With unknown arguments
0] :next
; (FIBO 5) => 8
8
*
So if you scroll all the way down, once it creates the two branches, the result is given and there are no more branches to step through. It doesn't even step through the process of addition.