Common Lisp and the Towers of Blub

So I’ve been teaching myself Common Lisp. It’s a slow process because I don’t get a lot of time to do it, and also I’m a bit slow. The reason I’ve been teaching myself? Well I’m wholly dissatisfied with C++, Java, C#, and to a much lesser extent Python. I still love C though. She’s my lady. We connect.

The dissatisfaction started after I read Paul Graham’s “Hackers and Painters” book. I wrote about it too. Whilst reading the book I came across this paragraph and identied myself as a card-holding member of team “Blub”:

As long as our hypothetical Blub programmer is looking down the power continuum, he knows he’s looking down. Languages less powerful than Blub are obviously less powerful, because they’re missing some feature he’s used to. But when our hypothetical Blub programmer looks in the other direction, up the power continuum, he doesn’t realize he’s looking up. What he sees are merely weird languages. He probably considers them about equivalent in power to Blub, but with all this other hairy stuff thrown in as well. Blub is good enough for him, because he thinks in Blub.

Since then I’ve been on a journey. It’s taken me through books, well a book. I’ve discovered that Emacs is like 1 million times more powerful and sexy than her slightly musty smelling older sister Vi, with whom I’ve had an almost 15 year relationship and am trying to get out of my head. :x!

If you don’t believe me about Emacs (and why should you) consider how you’d write a video editing suite in whatever code editor you use or can extend. I already knew long ago that Emacs is at least partly written in Emacs Lisp but I should have guessed that arguably the most productive Common Lisp development environment, or IDE, is also an Emacs extension called SLIME.

Soon after that I discovered some fantastic screencasts in the Ruby On Rails mould for stupid people (like me): SLIME, Hunchentoot, and Selenium. BTW, I know Selenium is not Common Lisp but the screencast presents a Common Lisp binding to the Selenium Remote Control server that makes it possible to use Selenium from Common Lisp as a testing framework.

So it feels like I’ve come along way. But today, your humble programmer-of-Blub discovered something on the HyperSpec that scared me a little. Through the PlanetLisp RSS feed I discovered that I am also really crap at mathematics. I did this by trying some of these puzzles. In attempting to solve puzzle #2 in Lisp I found I needed to brush up on some Lisp basics. After some digging, and through a series of HyperLinks, I ended up here and before that here:

;; This illustrates the use of SETQ on a symbol macro.
 (let ((x (list 10 20 30)))
   (symbol-macrolet ((y (car x)) (z (cadr x)))
     (setq y (1+ z) z (1+ y))
     (list x y z)))
=>  ((21 22 30) 21 22)

I think I stared at this code snippet for about 2 minutes before it finally made sense when I at last remembered that setf works on a place and not a symbol. Now, I’m guessing an experienced Lisp-er would look at the sample and say ‘so-what’? I’m guessing that non-Lispers would say, anything that looks that complicated must be bad.

And this is when it struck me again. And this time it hurt. I may have lost a little “Blub” to get this far but I still have way much more “Blub” to lose.

12 replies on “Common Lisp and the Towers of Blub”

PCL is an awesome book, and it will get you running in Lisp.

If you want to go down the rabbit hole however (and since you asked), here’s my advice: read SICP. If you’ve been programming in Algol-inspired languages for the last 15 years, your head will probably explode. It is worth it. Do the examples. Follow along with the videos: they contain all kinds of little nuggets of wisdom that may take time to sink in.

After SICP, read PAIP. PAIP is just–I mean, damn–just read it.

If you can get through both of those (it’s hard work but you can do it, little engine!) and grasp the concepts, you will come out the other side a completely different and better programmer. It is worth it.

Post your progress here.

I would caution you to not read too much into the CLHS examples. First and foremost they are meant to clarify the definitions to Common Lisp implementors and so can often be rather contrived to quickly point out interesting corner cases.

Thanks for helping me discover that I too am crap at maths (project Euler).
For the life of me I can’t understand how you got to using symbol-macrolet to solve problem 2, though 🙂

Don’t do it Steve! Save yourself whilst other human beings still (sort of) understand you!

I gave Lisp a month of my life a few years ago. I had to stop when I wore out my bracket key. Lisp did give me a new perspective on things: Languages for Real Programmers = bad. Languages for Children = good. Right now I’m using a lot of Flex and it makes me happy.

One might also consider that if it really was the greatest language in the world, maybe I might of found an application written in it somewhere, someday (yes, aside from Emacs). I’ve used a feed reader in Smalltalk, a jabber server in Erlang, but never anything in Lisp. And Mr Paul Graham might want to admit that he’s paying for his champagne in Python generated money, from selling reddit after they re-wrote it from Lisp to Python.

Happy bracket counting.

Hi Graham!

>> maybe I might of found an application written in it somewhere, someday

You raise an excellent point, but of course I have a response. I’m not sure if Lisp’s resurgence will come to anything much but it’s starting to become clearer to me that the original claims about Lisp are based in some truth. Lisp is more powerful than anything I’ve used before and since I’m not a master of the universe yet a little more power wouldn’t go a miss! There is of course a cost.

Richard Feynman developed his own set of nomenclature for calculus (Surely You must Be Joking) which was, to him at least, far superior than the ones that we already had developed.

And so it is with Lisp, I think, and like Feynman’s calculus it’s adoption is a problem of communication. Lisp might be a more efficient representation of a program but there is an up-front cost to understanding what it means because by current standards it is somewhat unconventional.

A mutual ex-colleague of ours (Brian Egge) reminded me that software often gets rewritten a few times and if the first version is written in Lisp and subsequent ones are not then that’s not necessarily a failure it’s just how it is. It’s a language that cries out as a candidate for proof-of-concept ideas in powers-of-one shops. That’s why it’s got me hooked.


Lisp is very powerful, too powerful for many programmers, and far too powerful for most managers / companies.
Since people are not likely to change much, the adoption of Lisp is unlikely to change much. Yes, it’s more popular now (with developers) than in a long time, but this has more to do with internet, blogs and rss feeds than the language itself, which has been this way for ages.
So by all means, learn it and love it – but expecting to see a lot of apps around actually written in CL? Not that likely.

I had that same question, “If Lisp is so great, how come no one uses it?” There’s a forthcoming blog post inside me that examines the logic behind the statement, but for now I’ve started compiling a list of companies that are known to use Lisp. Granted, it’s nothing compared to companies that use C, Java, etc, but it’s something. I’m still working on it and have some big lists to parse. Take a look:

From my personal experience at work i must say there aren’t many big projects developed in some less mainstream languages simply because employers and people in charge are afraid of programming languages with a smaller userbase.
At work we develop stuff for web mostly on php and when i tried to implement some projects in Smalltalk Seaside framework i was greeted with something along the lines of “That looks very promising, but if you ever get hit by bus where the heck am i supposed to pick a programmer that can work in this language charging the same fees i’m paying you?” and that was the end of it. Obviously i live in a small country and that might justify this behavior, personally, i still see it as short-sight.

From my personal experience at work i must say there aren’t many big projects developed in some less mainstream languages simply because employers and people in charge are afraid of programming languages with a smaller userbase.

Yes you’re right and I don’t think this is going to change. Whilst there is a theory (and I’m sure it’s true) that if you can find a good programmer they are good regardless of the language so the programming language is not really the problem. The problem is finding the management with vision.

The thing that perplexes me the most is whether good programmers would want to program in something other than a mainstream language because it might reduce their marketability.

Comments are closed.