Robert A. Uhl

In praise of Common Lisp

Years ago in school I was introduced to Lisp; my opinion was not very favourable. It appeared to be a goofy theoretical language, useful for exploring functional programming and maybe for AI work, but not for solving real-world problems. I don’t believe that I’m alone in having gotten that impression; for some reason all too many college CS programmes focus on teaching C and Java.

Be that as it may, I had the sneaking suspicion that Lisp might actually be far more practical than it had appeared. Folks like esr wrote that ‘Lisp is worth learning for a different reason — the profound enlightenment experience you will have when you finally get it’; Paul Graham wrote many articles detailing, among other things, how Lisp was a competitive for his successful startup; Phil Greenspun expounded the famous Greenspun’s Tenth Rule of Programming: ‘Any sufficiently complicated C or Fortran program contains an ad-hoc, informally-specified, bug-ridden, slow implementation of half of CommonLisp.’ And so I began to wonder what I’d missed.

Then Slashdot published a review of Practical Common Lisp, which I then bought. It was as though a door had opened in a hitherto-impenetrable wall! Seibel’s superlative work showed how Common Lisp could be used usefully.

So, what is Lisp? Well, it’s a functional language. And an imperative one. And an object-oriented one. It’s interpreted. And compiled. It’s dynamically extendable: the programmer has full access to the entire language when programs are read in, when they’re compiled and when they’re run. He can create new syntax; he can replace standard syntax. He can connect to a running application and modify it, correcting bugs as he goes.

CLOS, the Common Lisp Object System, is amazingly powerful. Rather than having methods tied to a single class, as with most object systems, methods are specialised on one or more classes — and they can be added after the class has been defined. This means that any programmer can easily and seamlessly extend a built-in class. Want to add regexp matching to strings? Then do it — there are no hoops to jump through.

Quite frankly, Common Lisp is an incredible language which has spent far too long in the background. So, of course, I’m rewriting my tasting notes app in it to see how it works. So far, it’s really cool.


Share