Tuesday, June 13, 2006

Introductory Lisp Books

  I've been doing a little reading about Lisp lately.  In particular, I've read two books on the subject.  ANSI Common Lisp by Paul Graham and Practical Common Lisp by Peter Siebel.  I haven't finished either book but I've read enough to give an assessment of the two.  If you are considering learning Lisp, read on for my recommendation.
   Let me start by saying that both books are good.  Both books assume that you already understand how to program.  Neither book is written for someone who is brand new to the art.  They both cover the subject of ANSI Common Lisp which is probably the predominant dialect of Lisp. 
   Practical Common Lisp starts off with a quick tutorial and moves on to a simple database implementation.  Only after these two examples does Mr. Siebel start describing the syntax and symantics of the language.  After some typical programming book subjects like functions, variable, control structures, and macros, the book goes back to examples.  The examples are easy to follow and give you a good sense of how Lisp is to be used.
   ANSI Common Lisp is written by Paul Graham who also writes on the subject of startups, geek culture, and programming langugaes over at his web site.  Mr. Graham takes a different tack.  After a quick introduction/tutorial, he describes the language via data structures--talking about lists and other data structures.
   My preference is for the ANSI Common Lisp book.  There are two primary reasons for this:  1)  it is more accessible to a C/C++ programmer and 2) it flows better. 
   ANSI Common Lisp approaches the subject from a perspective that is understandable to a C/C++ programmer.  Whereas Practical Common Lisp describes the Let/Setf operators by talking about "bindings", ANSI Common Lisp describes it in terms of variables and pointers.  The first requires becoming fully versed in a new way of thinking.  The latter comes naturally.  PCL also introduces forms and s-expressions but describes them in terms of other Lisp concepts.  This makes it hard to understand unless you already grok Lisp, which, if you are reading the book, probably isn't the case.  ACL avoids these concepts in the abstract and only introduces them with concrete examples.
   PCL also commits what I like to call the carnal sin of programming books.  It uses concepts in its examples before actually introducing them.  For example, in an example on page 94, it uses the first, second, and third functions.  Unfortunately, it doesn't actually explain what these are until page 143.  ACL, on the other hand, seems to build more logically upon the previous pieces it has introduced.
   It should be noted that PCL is available for free as a PDF if that is to your liking.  Personally, I prefer dead trees.

2 comments:

  1. I can highly recommend the SICP lectures (available as free video downloads)


    http://swiss.csail.mit.edu/classes/6.001/abelson-sussman-lectures/


    More fun than reading a book, and with added 1980's fashion sense too!

    ReplyDelete
  2. Thanks for the recommendation.  I actually have already begun watching those.  I'm 2 lectures in I think.  I'm enjoying them so far.  My only complaint is that they have a highly mathematical bent to them.  All of the examples are math problems.  Find a fixed point.  Find a square root.  Solve the towers of Hanoi.  I'd prefer something more practical.

    ReplyDelete