Vinn
Vinn

Reputation: 1181

How can I exit a program running in the repl in common lisp?

when I run a function in the repl, the repl becomes a place to input user values.

For example:


(defun asking-questions ()
  (let ((firstname (prompt-read "What is the firstname of the contact?"))
    (email (prompt-read "What is their email?"))
    (company (prompt-read "What is the company name?"))

.... ))

(defun prompt-read (question)
  (format *query-io* "~a:  " question)
  (force-output *query-io*)
  (read-line *query-io*))

Sometimes, I want to 'cleanly' close the program mid-way through because I am experementing with the email input (for example.

My desired outcome is to press a set of keys that allow me to go back to the package>. How do I accomplish that?

I use emacs + SBCL.

Upvotes: 1

Views: 571

Answers (2)

coredump
coredump

Reputation: 38809

For completeness, in a terminal directly interfacing with the REPL the C-c interrupt command should bring you to the debugger, where you can abort the computation up to the toplevel loop.

Upvotes: 1

ad absurdum
ad absurdum

Reputation: 21323

If you are using Slime with emacs you can press C-c C-b to drop into the debugger where you can abort the program by choosing an appropriate restart.

Upvotes: 3

Related Questions