Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

A simple example of using the stepper in SBCL

Tags:

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.

like image 666
muuh-gnu Avatar asked Dec 23 '11 14:12

muuh-gnu


People also ask

How does Sbcl work?

SBCL provides a recursive event loop ( serve-event ) for doing non-blocking IO on multiple streams without using threads. SBCL allows restricting the execution time of individual operations or parts of a computation using :timeout arguments to certain blocking operations, synchronous timeouts and asynchronous timeouts.

How do I exit Sbcl?

To quit SBCL, type (quit) .

Which command is used to exit Lisp system?

You can quit your lisp session by getting to the command line (possibly through pressing Control-C), then typing (quit) and pressing return.


1 Answers

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

like image 96
Rainer Joswig Avatar answered Sep 19 '22 23:09

Rainer Joswig