The language

Common Lisp (CL) is a general purpose, multi-paradigm programming language, member of the Lisp family. It supports a combination of procedural, functional and object-oriented programming paradigms. It has a dynamic typing system, but also supports optional type annotations for performance. It is extensible through the use of Lisp macros and reader macros. It has been standardized via an ANSI document.

Various resources about the language can be found in the external links below.

Implementations

Since Common Lisp is a standard, it can be implemented in different ways.

The following Common Lisp implementations are currently available in Debian:

There was also an unfinished attempt to package Clozure Common Lisp (CCL), see bug 609047 (the problem is that ffigen, needed to build CCL, embeds old GCC sources).

Implementations differ notably in:

Despite these differences, a CL program compliant with the ANSI standard will run across all implementations.

SBCL is recommended for newcomers (available on the amd64, armel, armhf, arm64, i386, powerpc, ppc64 and ppc64el architectures; for others, ECL or CLISP are good options).

Just launch the implementation executable on the command line to enter the REPL (Read Eval Print Loop), i.e. the interactive interpreter. Here is a sample session:

user@debian:~$ sbcl
This is SBCL 1.3.14.debian, 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.
* (+ 1 2)
3
* (quit)
user@debian:~$

Libraries

Hundreds of Common Lisp libraries are available under a free software license. This section describes how to get access to them under Debian.

Some terminology

Via APT

Dozens of Common Lisp libraries are packaged in Debian. The package names usually begin with the cl- prefix (use apt-cache search --names-only "^cl-.*" to list them all).

For example, in order to use the CL-PPCRE library (for regular expressions), one should first install the cl-ppcre package.

Then, in SBCL, CLISP and ECL, it can be used with:

(require "asdf")
(require "cl-ppcre")
(cl-ppcre:regex-replace "fo+" "foo bar" "frob")

Note: the first time you load packages through require, it may take some time while the implementation compiles the source. The result will be cached under ~/.cache/common-lisp/, so that next time, loading will be much faster.

Other implementations (CMUCL, GCL) currently don’t come with ASDF preinstalled. So the example above should be amended in two ways:

/!\ As of 2017-08, ASDF does not work with GCL.

Via Quicklisp

Quicklisp is both a central repository containing hundreds of CL libraries and projects, and a piece of software for easily downloading and installing these libraries. Quicklisp is to Common Lisp what CPAN is to Perl or pip+PyPi is to Python. Quicklisp currently works with all CL implementations in Debian except GCL.

You first need to setup Quicklisp in your home directory:

Now you can use the following functions:

Once a system has been installed through Quicklisp, it can be loaded with require, as documented in the previous section (provided that Quicklisp has been loaded before).

Development environment

The usual extension for Common Lisp source files is .lisp (or less frequently .lsp or .cl).

emacs is the editor of choice for hacking in CL, using the Lisp mode (which will be automatically activated one a .lisp file is opened). You may want to customize the lisp-indent-function option and set it to 'common-lisp-indent-function in order to use the Common Lisp indentation rules (instead of those of Emacs Lisp).

The experience can be further improved by installing slime (the Superior Lisp Interaction Mode for Emacs), which transforms Emacs into a full IDE, with features such as: online documentation, symbol completion, interactive code evaluation, a debugger, an object-inspector… SLIME can be started using M-x slime (optionally give it a prefix or customize slime-lisp-implementations to change the default implementation choice).

Other noteworthy Emacs extensions are elpa-rainbow-delimiters and elpa-paredit that help with the editing of parentheses within Lisp expressions.

On the documentation side, the hyperspec package can download and install the Common Lisp HyperSpec (CLHS), which is a complete HTML reference of the ANSI standard, covering all Common Lisp functions, macros and variables (the package is in the contrib section, since the HyperSpec is distributed under a license incompatible with the Debian Free Software Guidelines). The HyperSpec can be accessed either:

Applications

In Debian, the following applications are written in Common Lisp:

The following Debian packages also use Common Lisp for some of their functionality:

Packaging Team

The Debian Common Lisp Team maintains many CL-related packages in Debian. See Teams/DebianCommonLisp for resources and ways to contribute.

External links