Lisp: where to start

When I first set out to learn lisp, I was faced with an intimidating number of choices. Which implementation of lisp should I choose? Common lisp? Scheme? I went with common lisp. Which common lisp? SBCL? MCL? Gnu clisp? Yeesh. This is enough to scare most lisp rookies off. Here is some advice: start off with Gnu clisp. It’s available for most architectures, it’s free, it has decent documentation online, and it’s easy to install.

A brief explanation of the lisp distribution

Lisp began in the fifties and was the cool new thing. After a few years, new features were needed, and by this time, there were already several groups that had written interpreters for the language (lisp is both an interpreted language, like Perl, and a compiled language). Each had added features to the language in different ways. Various groups got together to standardize the language. This was a good thing at the time because it brought together all of those differences into one standard. However, once a language is standardized by a large committee, it becomes that much more difficult to update it, especially if it means straying from the standards. Lisp often gets around this because it has macros, which are functions that can create new syntaxes for the language.

The standard was called common lisp, and is supported by most major distributions of lisp. There are other, lisp-like languages from before the standard, such as Scheme, that survived outside the standard because they were already well-established.

Other distributions, such as SBCL, MCL, Gnu, Allegro, et al., support the common lisp standard. Each, however, has extras that come with them. Think of them the same way you would think about Linux distros; each supports a basic core functionality, but some specialize in certain areas and have extra libraries and built-in functionality that express this. For example, MCL is built for Macs, and has the ability to work in tandem with AppleScript and Apple’s windowing libraries. I originally chose Gnu clisp because it had built in regex functions, whereas many other lisps require that you install a 3rd party library to support regex (and installing 3rd party libraries is a semester-long course in itself).

How to learn lisp

There are dozens of tutorials online that you could start with. Hundreds, probably. The problem is that lisp was designed when software was written by engineers and scientists; there was no such thing as the hobbyist. Most online tutorials use scientific or mathematic examples that not everyone is familiar with. I myself have a degree in Spanish; most of the examples were pretty meaningless to me.

I found the online book, Practical Common Lisp, which was helpful, but still a little above my head in some areas. It jumps around a lot and is really for the established lisp programmer who wants to see how another advanced lisp programmer would ineffectively explain lisp to a rookie.

The best instruction I found was a book called, . It’s dumbed down pretty far, but because lisp is so different from other languages, it really is worth your time to go through the book to understand the concepts. After that, online tutorials will make some sense and you will have a good foundation from which you can build. At the very least, you won’t be confused when you see something like (eq (+ 2 2) 4).

Enter newLISP

If this is all a bit much for you and you just want a taste, give newLisp a look. It uses the same syntactic conventions as lisp, but it has a modern set of functions and is a completely interpreted scripting language, like Perl or Python. Even if, as with me, you decide to stick with newLisp over other lisps, will still benefit you immensely (even if you don’t stick with lisp at all, the book will make you a better programmer).

Leave a comment | Trackback
May 13th, 2007 | Posted in Tips
Tags: ,
No comments yet.