Sunday, April 26, 2009

Lisp, According to Me

Many other people have talked about Lisp at far greater length and in far more depth than I can. I therefore begin by assuming the reader has at least passing familiarity with Lisp and the oceans of ink spilled in its name.

My Road to Lisp

I started learning Lisp in high school, with (Gambit) Scheme, after being inspired by Steve Yegge's Tour de babel. I read On Lisp and wrote reams of Scheme to implement all sorts of fun things (looking through my old stuff, it seems I managed to generate more than 7 kLOC of Scheme during grade 12). Eventually, however, I realized that I was merely writing libraries, and not actually doing anything with them. This, along with a certain sense of curiosity, led to me taking up Common Lisp.

While I appreciate the conceptual purity of Scheme, I also find complex, powerful systems to be deeply intriguing (more on this in my upcoming post on Perl), so I immediately fell in love with CL. The sheer number of things you can do with it, even beyond macros...CLOS (probably my favourite object system), its unique (AFAIK, but I'm sure I'll be corrected if mistaken) and incredibly system of restarts and exceptions, ASDF, optional type tags...I could go on for ages. As Steve Yegge put it (albeit in a manner not meant to be flattering to CL):

  • Scheme is an exotic sports car. Fast. Manual transmission. No radio.
  • Common Lisp is Howl's Moving Castle.
While it's true that Common Lisp may not be exactly elegant...which would you rather have, a sports car, or a gigantic, semi-sentient, ambulatory castle with magic powers? I rest my case.

I have used Clojure a little bit, but mostly as a means of learning my way around Java without actually having to learn Java. Quite pleasant, and very nice to see a Lisp dialect that doesn't shackle itself to the legacy of the crufty CL standard, nor to the extreme minimalism of Scheme.

That being said, my language of choice eventually shifted from (Common) Lisp to Factor. I found that pretty much anything I could do in CL I could do at least as easily in Factor, but in a much cleaner manner, in a much more tightly-knit community, and crucially, I could see the evolution of the language over time: Unlike Common Lisp, which has been basically unchanged for longer than I've been alive, Factor is still growing and evolving, and knowing I can (and have, in some small way, I may flatter myself to think) help shape the future direction of the language is a powerful incentive.

Well, that went off on a bit of a tangent (mayhaps I should do an entry of Factor?), so let me try to summarize my attitude towards Lisp. While I was once convinced that Lisp was the language, more experience with other languages has led me to begin to question that. It is indeed a very enjoyable language to program in, and macros are certainly the cat's pajama's, but I'm not sure if it's really that much better than some of the interesting newer languages on the scene, such as Haskell, Factor, et cetera. So...a very nice language, one that I had a long infatuation with, but not necessarily the end-all be-all of languages.

No comments: