在SBCL中使用步进器的一个简单例子 [英] A simple example of using the stepper in SBCL

查看:145
本文介绍了在SBCL中使用步进器的一个简单例子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用LispWorks步进器进行计算是非常直观的,但是我无法在SBCL中得出结论。有人可以给我一个一步一步的例子,说明如何在REPL中使用SBCL步进器实现一些简单的功能?感谢。

解决方案

  *(宣传'(优化(调试3)))

*(defun foo(ab)(*(+ ab)b))

FOO
*(step(foo 1 2))
;评估呼叫:
; (FOO 1 2)
;有参数:
; 1
; 2

1] step
;评估呼叫:
; (+ A B)
;有未知参数

0] step
;评估呼叫:
; (*(+ A B)B)
;有未知参数

0] step
; (FOO 1 2)=> 6

命令:

 步进:
START选择CONTINUE重新启动,如果存在,并启动
单步。单步执行仅影响以高DEBUG优化质量编译的代码

有关详细信息,请参阅用户手册。
STEP进入当前窗体。
NEXT在当前窗体之上。
OUT停止暂时步进,但是当最上层的
框架退回时,它会恢复。
STOP停止单步。

请参阅SBCL手册:单步


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.

解决方案

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

这篇关于在SBCL中使用步进器的一个简单例子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆