一个在SBCL中使用步进器的简单示例



使用LispWorks步进器进行计算相当直观,但我无法在SBCL中弄清楚。有人能给我一个循序渐进的例子,如何在一些简单的功能上使用REPL中的SBCL步进?谢谢。

* (proclaim '(optimize (debug 3)))
* (defun foo (a b) (* (+ a b) b))
FOO
* (step (foo 1 2))
; Evaluating call:
;   (FOO 1 2)
; With arguments:
;   1
;   2
1] step
; Evaluating call:
;   (+ A B)
; With unknown arguments
0] step
; Evaluating call:
;   (* (+ A B) B)
; With unknown arguments
0] step
; (FOO 1 2) => 6

命令:

Stepping:
  START Selects the CONTINUE restart if one exists and starts
        single-stepping. Single stepping affects only code
        compiled with under high DEBUG optimization quality.
        See User Manual for details.
  STEP  Steps into the current form.
  NEXT  Steps over the current form.
  OUT   Stops stepping temporarily, but resumes it when the topmost
        frame that was stepped into returns.
  STOP  Stops single-stepping.

参见SBCL手册:单步操作

最新更新