Getting your notebook-style environment for experimenting with Lisp programming up and running
Published on Dec 20, 2020 by Marcus Santos.
This article provides the installation steps for common-lisp-jupyter, a notebook-style Lisp programming environmentand developed by Tarn W. Burton.
Caveat lector: The cell-based style of jupyter notebooks is great for experimenting with elements of a programming language and prototyping simple code. However, as soon as your programs start growing in size you will quickly end up duplicating code and missing more powerful editing features provided by a Emacs+Slime-based Lisp development environment.
Installation
Lisp compiler
On both Linux and OS X, we’ll use Steel Bank Common Lisp (SBCL) as the Common Lisp implementation.
Ubuntu/Debian
To install SBCL on either, just run:
$ sudo apt-get install sbcl
Arch Linux
Since SBCL is available from the official repositories, you can install it with:
$ sudo pacman -S sbcl
OS X
To install SBCL on OS X, just do:
$ brew install sbcl
Windows
On Windows, install the Windows binary available at the SBCL download page.
Jupyter
- Install Python version 3.3 or greater. Python is a requirement for installing Jupyterlab.
Install Jupyterlab
pip install jupyterlab
- Install Quicklisp by executing on the shell the commands shown in the gray box of this example of a quicklisp installation session.
Finally, Quicklisp install common-lisp-jupyter. Type the command below on the shell terminal
$ sbcl * (ql:update-dist "quicklisp") * (ql:quickload :common-lisp-jupyter) * (cl-jupyter:install) * (quit)
Running common-lisp-jupyter
Type the following command at the shell terminal
$ jupyter notebook
This will open a browser window listing your file folders.
- On the top right corner of your browser window, click on the dropdown menu labeled
New
, then selectCommon Lisp
.
This will start the common-lisp REPL. You can now type Lisp expressions to be executed.
Type the expressions below then click on Run
(defvar x 8) (/ x 3) (+ (* x x) 9)