Installing, running and quitting SBCL
Steel Bank Common Lisp SBCL is a Common Lisp implementation derived from the Carniege Mellon University Common Lisp (CMUCL). The “steel” and the “bank” in the name are references to the businesses of its founders (Andrew Carnegie and Andrew Mellon) so the relationship between them is clear. SBCL is very popular and you can get it running on your machine quite easily.
Installing on Linux
Almost all Linux distributions include a sbcl
package.
- Fedora ->
sudo dnf install sbcl
(not always updated to the latest version) - Ubuntu ->
sudo apt install sbcl
- Arch ->
sudo pacman -S sbcl
Windows, Mac and other platforms
You can download a prebuild binary or sources for any platform from the dedicated page on the SBCL website. Also a ready-to-use docker image exists, and even if it is not an official image you can trust it because it is from a well known Lisper.
Running
Executing sbcl
from a command line will show you an initial information message and the prompt - the last line starting with *
.
$ sbcl
This is SBCL 2.0.1, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.
SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses. See the CREDITS and COPYING files in the
distribution for more information.
*
In this way we have started the SBCL interactive REPL1 so we can type instructions and execute them pressing Enter
. The result of the computation will be shown below.
* (+ 1 2)
3
Quitting
Now you may be wondering how to quit the REPL, and so you may have pressed the ubiquitous CTRL-C
. It doesn’t work and this weird error is shown.
* ^C
debugger invoked on a SB-SYS:INTERACTIVE-INTERRUPT in thread
#<THREAD "main thread" RUNNING {1000510083}>:
Interactive interrupt at #x7F41875058D7.
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.
("bogus stack frame")
Sometimes stopping an application is not as obvious as we might think. And it looks like this is another chapter from the Art of Quitting book. To quit from the SBCL REPL you just need to type (quit)
followed by Enter
.
-
Read–eval–print loop. The first REPL was truly invented in 1964 by L. Peter Deutsch and Edmund Berkeley while implementing Lisp on the PDP-1. Peter Deutsch was 17. ↩