A simple example of using the stepper in SBCL

被刻印的时光 ゝ 提交于 2019-12-03 07:18:44

问题


Going through the computation with the LispWorks stepper is rather intuitive, but I cant figure it out in SBCL. Can somebody please give me a step-by-step example of how to use the SBCL stepper in the REPL on some simple function? Thanks.


回答1:


* (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

Commands:

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.

See the SBCL manual: single stepping.



来源:https://stackoverflow.com/questions/8617064/a-simple-example-of-using-the-stepper-in-sbcl

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!