Next: , Previous: , Up: Lisp Quickstart   [Contents][Index]


5.12.4.2 Breaking Lisp

Pressing ‘Control-C’ in Lisp halts whatever is presently running and returns you to the command line. After you press ‘Control-C’, the command line changes to a "subsidiary" command line to reflect that you are in a break or error condition. Kinda like pressing ‘Control-C’ in a debugger. These conditions can be stacked: if you keep working while in a condition, and then get in another condition and so on, you’re piling up conditions on a stack.

$ sbcl

* (loop)
^C
debugger invoked on a SB-SYS:INTERACTIVE-INTERRUPT in thread
#<THREAD "main thread" RUNNING {1001890143}>:
  Interactive interrupt at #x52BB2ED0.

Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
  0: [CONTINUE] Return from SB-UNIX:SIGINT.
  1: [ABORT   ] Exit debugger, returning to top level.

((LAMBDA ()))
   source: (PROGN)
$ clisp

[1]> (loop)
^C
** - Continuable Error
EVAL: User break
If you continue (by typing 'continue'): Continue execution
The following restarts are also available:
ABORT          :R1      Abort main loop

Just like in a debugger, at any break or error condition, you have a bunch of options (like examining the stack, changing what the return value should be, etc.) You can even continue the infinite loop we just broke out of. But you probably just want to escape. The easiest option is to escape out of all of your error conditions, right back up to the top.

SBCL

In SBCL on your laptop, this is done by typing :top or :n (where n is the largest number presented to you – here it’s 1).

CLISP

In clisp on zeus, you’d type :R1


Next: Quitting Lisp, Previous: Running Lisp, Up: Lisp Quickstart   [Contents][Index]