Clementson's Blog

Bits and pieces (mostly Lisp-related) that I collect from the ether.

May 2004
Sun Mon Tue Wed Thu Fri Sat
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31
Apr  Jun

Learning CL with Paul Graham's ANSI CL book

Monday, May 17, 2004

ANSI CLpadThe other day, I mentioned that I really liked Paul Graham's book On Lisp. His other Lisp book, ANSI Common Lisp is also really good. However, there are a number of areas where Paul's own preferences show through in this book. Although I share a number of the same preferences, reading his book as a first CL text might "taint" your approach to programming in CL before you have a chance to make up your own mind about some things. However, Paul's book really is a good intro to CL, so what to do? You might try supplementing reading the book with Chris Riesbeck's set of chapter annotations and his notes on the exercices from ANSI Common Lisp. He prepared these for the CS325 - Introduction to AI Programming course at Northwestern University. There are also a set of lecture notes that contain some good CL introductory material. While you're on the site, you might want to have a look at Chris's Bug Finder and Lisp Critic utilities. In addition, the code library for the course includes utility code, project code, and all the ANSI Common Lisp code that appears in the main figures, downloaded from Graham's original source file.

So, what are the areas where Chris feels that Paul Graham's CL coding style is not "typical"? Here are some of them:
  • Strong preference for if rather than cond, even when using if leads to nested if's or embedded progn's.
  • Strong distaste for loop, because it is so complex and different from the functional programming style. Sometimes, however, loop is the clearest simplest way to write something.
  • Preference for recursion over iteration, even if it might lead to code that causes stack overflows on very long lists.
The nice thing about reading Chris's annotations is that he provides a commentary (expansions, disagreements, challenges) on various items in the book. This helps to point out where alternative views (to Paul's) might exist.

emacs Copyright © 2005 by Bill Clementson