articles‎ > ‎2007‎ > ‎4‎ > ‎25‎ > ‎

The truth about Lisp

I’m relatively new to Lisp. I’ve only been exposed to it in some of my computer science classes, because Lisp is big in AI. Actually Lisp was pretty much invented specifically for AI.

I have nothing against Lisp. In fact, I hear that Matz borrowed heavily from Lisp when creating Ruby. I think I could almost enjoy writing Lisp code, but I don’t know that I would enjoy it as much as Ruby. You have to at least respect Lisp for it elegance and history. It is arguably one of the oldest language still in relatively wide use today.

Now I have this dear AI professor, and he is something of a Lisp fanatic. He keeps talking about how great it is that all of us in his class will get to write significant amounts of Lisp code, because it is a crime that people can get through a computer science degree and not learn one of the greatest programming languages invented. However, he admits that there are problems with Lisp when it comes to compatibility between Lisp implementations, and between platforms with the same implementation. A lack of good libraries is also a problem with Lisp that many Lispers will even fess up to.

I asked him, “Why not use Ruby?” It’s more compatible across platforms. It has great libraries.

His response? Ruby is slow (of course this is true, but it seems like a premature optimization to me). Ruby doesn’t have macros.

On the macros charge, you have to understand Lisp macros. They are a very elegant way of doing preprocessing. Unlike a C/C++ preprocessor, Lisp macros are more than just string replacement. In a Lisp macro you have the full power of the Lisp language to manipulate code as if it was data, because in Lisp data is code and code is data.

My thing is that you have to ask how much do people really use macros and how much do they use them in a way that would be impossible in Ruby? For me, I don’t think there is a big macro shaped hole in Ruby, but I may not be doing the kinds of things that would really benefit from macros. In Lisp macros are most often used for making DSLs, which can be done quite successfully in Ruby, thank you very much. (Some of these points are argued elsewhere.) If you need the power of macros, then use Lisp. If you need speed, then use Lisp. If you need compatibility and better library support, then use Ruby.

So hopefully it is clear by now that I’m not trying to diss Lisp. It is definitely a worthy tool to have in your toolbox, but I still have to link to this because it is hilarious: The Truth about Lisp You may also be interested in this: Programmer Hierarchy

These will only be funny if you’ve read any articles about someone’s Lisp “Conversion Experience.” Or if you’ve read any Lispers write about how great their language is.

If you’re interested in getting some Lisp goodness in Ruby check these out:

If It’s Not Nailed Down…Steal It

Ruby Quiz: Lisp Game

Originally published on April 25, 2007 at 5:03 pm