Is there a command to halt the interpreter in Common Lisp?

前端 未结 5 661
醉梦人生
醉梦人生 2021-02-12 09:57

I\'m looking for an expression that will cause the interpreter to exit when it is evaluated.

I\'ve found lots of implementation-specific ones but none in the HyperSpec,

5条回答
  •  生来不讨喜
    2021-02-12 10:00

    As far as I know, this is not covered by the Spec, and you will have to use the implementation-specific solutions, or maybe try and look if someone has already written a trivial-quit lib (or start one on CLiki).

    If you only care about interactive use, ,q in SLIME will always do the right thing. Otherwise, you may use read-time conditionals like this:

    (defun my-quit ()
      #+sbcl (sb-ext:quit)
      #+clisp (ext:exit)
      #+ccl (ccl:quit)
      #+allegro (excl:exit)) ;; and so on ...
    

    #+ checks, if the following symbol is in *features*. If not, the following form will be treated as white-space. (There is also #- for the opposite).

提交回复
热议问题