Debugging using SBCL.
Tell SBCL what you want to debug:
* (proclaim '(optimize (debug 3)))
Your code:
* (defun flattenizer (lst) (if (listp (car lst)) (flattenizer (car lst)) (if (null lst) nil (cons (car lst) (flattenizer (cdr lst)))))) FLATTENIZER
Performing it with STEP
* (step (flattenizer '(1 (2 3) 4))) ; Evaluating call: ; (FLATTENIZER '(1 (2 3) 4)) ; With arguments: ; (1 (2 3) 4)
next step
1] step ; Evaluating call: ; (FLATTENIZER (CDR LST)) ; With arguments: ; ((2 3) 4)
next step
1] step ; Evaluating call: ; (FLATTENIZER (CAR LST)) ; With arguments: ; (2 3)
next step
1] step ; Evaluating call: ; (FLATTENIZER (CDR LST)) ; With arguments: ; (3)
next step
1] step ; Evaluating call: ; (FLATTENIZER (CDR LST)) ; With arguments: ; NIL
next step
1] step ; Evaluating call: ; (FLATTENIZER (CAR LST)) ; With arguments: ; NIL
next step
1] step ; Evaluating call: ; (FLATTENIZER (CAR LST)) ; With arguments: ; NIL
It looks like you're in a loop right now.
Returning to the upper level.
1] top *
Now check the source code.
source share