UP | HOME

Marcus Santos

Emacs & Lisp enthusiast

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

lisplogo_fancy_256.png

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

  1. Install Python version 3.3 or greater. Python is a requirement for installing Jupyterlab.
  2. Install Jupyterlab

    pip install jupyterlab
    
  3. Install Quicklisp by executing on the shell the commands shown in the gray box of this example of a quicklisp installation session.
  4. 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

  1. Type the following command at the shell terminal

    $ jupyter notebook
    

    This will open a browser window listing your file folders.

  2. On the top right corner of your browser window, click on the dropdown menu labeled New, then select Common 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)