Common Lisp/First steps/Installation
In order to start programming in Common Lisp, you need to obtain a Common Lisp implementation. There are many of them available for most operating systems. There are both free and commercial implementations.
- 1 Browser-based
- 2 Complete environments
- 3 Free implementations
- 4 Commercial implementations
- 5 External Links
To try out Common Lisp commands without installing anything, the most practical tools are browser-based implementations:
There are also online REPL environments for other Lisp dialects, which can be useful:
- repl.it (uses the Scheme dialect, but with minor differences, can be used for basic Common Lisp commands)
- Himera (uses the Clojure dialect)
Lispbox is an attempt to provide a newbie-friendly Common Lisp environment working out of the box. In addition to a Common Lisp implementation, Lispbox includes:
- Emacs, a powerful and extensible text editor,
- SLIME, an Emacs extension which provides very good Common Lisp integration,
- ASDF, a Common Lisp extension for loading and installing code libraries and
- examples from the book "Practical Common Lisp."
Using Lispbox should be quite easy. After running it, Emacs should display a Lisp prompt, where you can edit code interactively. Try to paste examples from this book and see what happens. If you don't want your code to be lost, you should learn how to manipulate files and buffers in Emacs, which is outside the scope of this book (check out the tutorial that comes with Emacs, which you can either find through the editor's "Help" menu or by hitting Ctrl-H, T or C-h t in Emacs-speak). Once you created a new file with Emacs that contains Lisp code, check if you're in Lisp mode (if the file's extension is .lisp, then you probably are) and hit C-c C-k to compile and load the whole file, or C-c C-c to compile and load the top-level expression you're currently editing.
More info on using Slime should be included somewhere
Able is an editor where installing libraries can be done by putting it in the directory able/systems. It hopes to work out of the box. It also includes some libraries by default.
Note: Even if you don't want to install Lispbox, it's still highly recommended to use the Emacs/SLIME combination to interface with these implementations. The reason is that the text console which they provide is quite awkward to work with, so most users prefer a nicer environment like the one SLIME provides.
GNU CLISP is a popular free implementation which can run on Windows and most Unix-like systems. If you're using Windows, you don't have much choice but to use CLISP. CLISP provides all ANSI Common Lisp features and is quite easy to install.
- Full Unicode support
- Localised interface and compiler messages
- High portability: runs practically anywhere
- Compiles to portable bytecode (most or all other Common Lisp implementations compile to native code)
- Small memory footprint
- Arbitrary precision floating point arithmetic
- Slow at number crunching
CMU Common Lisp is a high performance Common Lisp implementation.
- Non-native threading (“green” threads; x86 only)
- Produces fast code due to its optimizing compiler that produces native code
- Fast compiler
- Relatively low portability (see the CMUCL portability webpage for a list of supported platforms)
Steel Bank Common Lisp, a fork of CMU Common Lisp, is a portable implementation featuring native code compilation. It's easily the most popular Common Lisp compiler on platforms which neither CMUCL nor CCL will run on and an excellent choice even on those mainly because of its better debugging support (for instance, its compiler yields more warnings and is said to be stricter regarding ANSI compliance).
- Unicode support
- Quite portable: runs on Unix-like systems including Mac OS X and Microsoft Windows.
- Native threading support on Intel-based platforms
- Good speed because of the optimizing compiler that produces native code
- Slow compilation speed (SBCL performs *many* optimizations, which can be slow)
Clozure CL is a Common Lisp implementation the PowerPC and AMD64. There is a pre-release x86 version. It is easily the most popular choice on Mac OS X, but it runs equally well on GNU/Linux and FreeBSD/amd64 systems; there is also a beta for Windows. On Mac OS X, CCL features a Cocoa interface.
- Full Unicode support
- A fast compiler that produces equally fast code
- A Cocoa interface for Mac OS X GUI development
- Native threading
Embeddable CL (ECL)
ECL is a Common Lisp implementation focusing on portability and embeddability. These goals are obtained by translating CL into C and passing that to a C compiler (typically gcc). It runs on Linux, FreeBSD, NetBSD, OpenBSD, Solaris and Windows, running on top of the Intel, Sparc, Alpha and PowerPC processors.
- Unicode support
- Translates CL into C, which produces relatively fast native code
- Interpreter which circumvents the slow build times
- Load on demand. ECL defers loading modules until needed
- Ability to output portable C source files that can be compiled on other architectures
- Call C from Lisp and call Lisp from C (i.e. ECL can be used as an extension language for any program that can call a C function)
- Native threading
- Relatively slow compilation method (gcc is slow, maybe if you use a faster C compiler)
- Relatively fragile error handling (i.e. you can seg-fault ECL fairly easily)
Armed Bear Common Lisp
ABCL is a Common Lisp implementation that runs on top of the Java Virtual Machine. It provides a runtime system, a compiler that compiles Lisp source to JVM bytecode, and an interactive REPL for program development.
- Produces portable Java bytecode
- Java libraries are transparently available
- Quite slower than other implementations
There are free trial versions of Allegro, LispWorks, and Corman Lisp, which can be handy for learning the language. All of them work on Windows.
- Common Lisp Implementations of various qualities.