Monday, February 9, 2009

Which Lisp to Learn?

So you decided to learn lisp and you are confused with all those choices.
There's something called Common Lisp (is that for common people only?), than Scheme (Would I become a Schemer?), than Arc, Clojure, NewLisp, Qi and who knows what. So before your head is going to blow your are going to comp.lang.lisp newsgroup and asking for a recommendation. Then the hell opens and your honest question erupted into an ugly flamewar with otherwise mostly good people accusing each other and calling other people ugly names. So while your asking yourself what have you done in your past life to deserve such faith let me explain you a few things. The name lisp is a general name for the lisp family of languages as per John McCarthy wish, the inventor of lisp, lisp should be used as label for the whole family of lisp languages instead of describing just one language. Something like c, c++, c# and java are family of c language & its descendants. That wouldn't be such a huge problem if the ruling patriarch of lisp family, common lisp had it's own newsgroup. Something like comp.lang.common-lisp , but (for unknown reasons) it doesn't. So all the common lisp users, the majority of lispers, dwell on comp.lang.lisp which is generic groups for all lisp family of languages. So your action was like going to generic group for c and c language descendants and asking what language should you learn. Hypothetically you would heard discussion like this :
c-user: Learn c it's the right real thing.
c++-user: No learn c++, c is too low level.
Java-user: No learn Java, it runs everywhere.
c#-user: No learn c#, it has best ide and tail call elimination.
d-user: No learn d, it has the latest and greatest staff.
And then everything will go to hell like:
c-user: c++ is ugly as sin.
c++-user: Java is dog slow.
java-user: c# is microsoftware
c#-user: Java is sunware
...duscussion continues with people calling each other ugly names

Now that you understand what happened let me give you my not so neutral
advice about most popular lisps so you could decide for yourself
which lisp to learn.
1.Common Lisp - It's an industrial strength, multi platform, specified
by ANSI standard lisp. It has the largest active community, many high quality
implementations, huge number of libraries, and enormous amount of material
to learn it even compared with mainstream languages.Also Kent Pittman excellent hyperspec is a first stop shop for any questions regarding Common Lisp.
2. Scheme is the language that started to be minimalistic but it abandoned that way with advent of latest standard. It is more aimed at functional style,and has full blown continuations, something that common lisp lacks. Though it has 2nd only to common lisp community, scheme community is balkanized across different implementations. Scheme has many high quality implementations but the problem is that there is many incompabilities between them since its still de facto standard R5Rs is very small. The latest standard R6RS smooths many incompabilities but it needs time to gain acceptance. Scheme also has huge amount of learning material.And the famous sicp is a must read for every serious lisper, not just schemers.
3. Qi - is a product of Mark Tarver, it introduces powerful static typing system, adapts pattern matching, embedded prolog etc.There is one excellent book by Mark Tarver, Functional Programming in Qi. Little learning material compared with common lisp and scheme. The community is small.Very few libraries, though you could use common lisp ones. Single implementation that runs on top of common lisp.
4. Clojure - Runs on top of JVM. Aimed at functional programming and introduces many novel ideas to support SMP and concurrency. One book, Programming Clojure, spartan reference manual. Little learning material compared with common lisp and scheme. Small community and libraries, though you could use Java libraries. And a single implementation.
5. NewLisp- simple lisp aimed at scripting. Three books and pretty good reference manual . Little learning material compared with common lisp and scheme. Small community and libraries.Single implementation.

If above descriptions of some of the lisps that I more of less tried didn't helped you to make your mind, than my recommendation is to go with common lisp, and then switch if you find other lisp more to your needs. Some lisps offer some new blood, but they all have much to learn to compete with a battle proven beast as common lisp. Though some lisps are better in some areas they are usually far worse in many other areas. In the end It's up to you. And yes I am a common lisper.

Learning common lisp

Everything you need to learn common lisp

There's a plenty material to learn common lisp, with many books and most of them free so If you want to learn you're spoiled of choices. Please note that labeling books as beginner or advanced is somewhat arbitrary as many beginner books have advanced material and many advanced books start with crush course of lisp.Also this is my personal opinion as I don't study in details each book on the list rather skimmed most of them.

Beginner books:
For learning common lisp if you're already experienced in some other
language and you just want to get on creating applications with lisp I would recommend Practical Common Lisp free as ebook, worth every cent of the paper edition.

If you're new to programming or just prefer slower pace :
2. Gentle introduction to symbolic computation would probably be a great choice. After you finish it you should probably continue with Practical Common Lisp, mentioned above.

The other great free ebooks, some of them offer printed editions are:
3.Succesfull Common lisp
4.Loving lisp
5. COMMON LISP: An Interactive Approach
6. Basic Lisp Techniques,
Also Great for starters but without free online editions are:
7 Ansi Common Lisp by Paul Graham
8 Lisp by Winston & Horn . This goes in later chapters into AI world.

There's some nice videos that Franz made available free of charge from their certification program at

Advanced books:
1. On Lisp: goes into most detail description in art of writing macros.
2. Paradigms of Artificial Intelligence Programming, though aimed at those intersted in AI it teaches Norvig great style of writing programs. Must have for every lisper.
3. Object-Oriented Programming in Common Lisp: A Programmer's Guide to CLOS by Sonya E. Keene teaches the common lisp object system
4. The Art of the Metaobject Protocol by Gregor Kiczales keep this until you're good at CLOS.
5. Let Over Lambda - concentrated on macros, I can't tell you more until my copy arrives.

There is also one book that you will heard that people recommend quite often: Structure and Interpretation of Computer Programs, by Abelson, Sussman, and Sussman. It's great book but it's not a common lisp book but in other language called Scheme. Though I recommend it to read it, if you decided to learn common lisp please read it after you feel comfortable with common lisp. Else you're going to just end up confused.

Choosing implementation for learning purposes is a non-issue. Common Lisp is specified by standard and all implementations must adhere to it so just pick up
whatever you find close to your preferences and previous knowledge. You can switch at anytime you want. If you're expecting Visual Studio or Eclipse like ide probably Allegro and Lispworks will serve you best. If you want open source, SBCL and Clozure CL are widely used. Scieneer is I heard best at SMP. If you're concentrated on portability CLisp is your pick. Armed Bear is dedicated for running on JVM and ECL is embeddable . There is also CMU CL and Corman Cl
All of them with do just fine for learning common lisp beside GNU CL(GCL) which I don't recommend, not to be confused with GNU CLisp.
For more detailed info check Dan's survey .