Common Lisp/First steps/Installation: Difference between revisions

From Wikibooks, open books for an open world
Jump to navigation Jump to search
[checked revision][checked revision]
Content deleted Content added
fix broken link; split out section for editors/environments (please correct the title if it's inappropriate) and add browser-based implementations
Line 1: Line 1:
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.
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.


== Lispbox ==
== Browser-based ==

To try out Lisp commands without installing anything, the most practical tools are browser-based implementations:
* [http://davazp.net/jscl/jscl.html JSCL] ([https://github.com/davazp/jscl#jscl about])
* [http://lisperator.net/s/slip/?ide Slip] ([http://lisperator.net/slip/impl about])

There are also online REPL environments for Lisp dialects, which can be useful:
* [http://repl.it/languages/Scheme repl.it] (uses the [[Scheme Programming|Scheme]] dialect, but with [http://www.cs.utexas.edu/~novak/schemevscl.html minor] [http://dept-info.labri.fr/~strandh/Teaching/Langages-Enchasses/Common/Strandh-Tutorial/diff-scheme.html differences], can be used for basic Common Lisp commands)
* [http://himera.herokuapp.com/ Himera] (uses the [[Clojure Programming|Clojure]] dialect)

== Complete environments ==

=== Lispbox ===


[http://www.gigamonkeys.com/lispbox/ 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:
[http://www.gigamonkeys.com/lispbox/ 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:
Line 13: Line 25:
''More info on using Slime should be included somewhere''
''More info on using Slime should be included somewhere''


== Able ==
=== Able ===


[http://phil.nullable.eu/ 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.
[http://common-lisp.net/project/able/ 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.


== Free implementations ==
== Free implementations ==

Revision as of 17:02, 11 August 2014

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.

Browser-based

To try out Lisp commands without installing anything, the most practical tools are browser-based implementations:

There are also online REPL environments for Lisp dialects, which can be useful:

Complete environments

Lispbox

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

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.

Free implementations

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

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

  • 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

  • Slow at number crunching

CMUCL

CMU Common Lisp is a high performance Common Lisp implementation.

Features

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

Shortcomings

SBCL

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

  • 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

  • Slow compilation speed (SBCL performs *many* optimizations, which can be slow)

Clozure CL

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

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

Features

  • 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

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

Features

  • Produces portable Java bytecode
  • Java libraries are transparently available

Shortcomings

  • Quite slower than other implementations

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