Jump to content

Common Lisp/First steps/Installation

From Wikibooks, open books for an open world

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.

Editors

[edit | edit source]

Emacs

[edit | edit source]

The easiest way to get started with Common Lisp is to use Emacs. Emacs, or you'll hear people sometimes refer to it as "vanilla Emacs", is the preferred way to write lisp by a majority of lispers. If you're also new Emacs then the below might be helpful, but they might also feel overwhelming for new users. If you're going to use Emacs, you should probably also install slime. Slime will help you edit common lisp; it comes included with the environments below.

Portacle

[edit | edit source]

Portacle is a portable and multi-platform Common Lisp environment, which is usually recommended to beginners nowadays. It offers SBCL, Emacs (with nice customization), Quicklisp and Git packaged together. There is no installation needed, so it really is a straightforward way to go.

Doom Emacs

[edit | edit source]

Doom Emacs is a popular pre-configured version of Emacs that is suitable for beginners and advanced users alike.

spacemacs

[edit | edit source]

spacemacs is another popular pre-configured version of Emacs that comes fully equipped for use with Common Lisp.

vim, or neovim, is a very common text editor for programmers. If you're already familiar with vim, you can still use it to edit Common Lisp as well.

slimv

[edit | edit source]

slimv is probably the most popular vim plugin for editing Common Lisp.

vlime

[edit | edit source]

vlime is a newer alternative to slimv that is mostly written in viml (vim's extension language).

Free implementations

[edit | edit source]

Note: Even if you don't want to install Portacle, 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

[edit | edit source]

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.

Features

[edit | edit source]
  • 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

Shortcomings

[edit | edit source]
  • Slow at number crunching

CMUCL

[edit | edit source]

CMU Common Lisp is a high performance Common Lisp implementation.

Features

[edit | edit source]
  • Non-native threading (“green” threads; x86 only)
  • Produces fast code due to its optimizing compiler that produces native code
  • Fast compiler

Shortcomings

[edit | edit source]

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).

Features

[edit | edit source]
  • 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

Shortcomings

[edit | edit source]
  • Slow compilation speed (SBCL performs *many* optimizations, which can be slow)

Clozure CL

[edit | edit source]

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.

Features

[edit | edit source]
  • 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)

[edit | edit source]

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.

Features

[edit | edit source]
  • 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

Shortcomings

[edit | edit source]
  • 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

[edit | edit source]

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.

Features

[edit | edit source]
  • Produces portable Java bytecode
  • Java libraries are transparently available

Shortcomings

[edit | edit source]
  • Quite slower than other implementations

Commercial implementations

[edit | edit source]

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.

[edit | edit source]