Lisp for Beginners

One of the few online forums I find valuable enough to make it a point to really follow these days is the clojure mailing list.

I recently realized that there’s one recurring theme that really irritates me: the “make it easier for beginners” thread.

This sort of thing always seems to come from someone who either a) is learning to program or b) is teaching a beginners’ programming class. You get a few belly aches from experienced programmers who are trying to make the conceptual leap into either lisp or java, but those are pretty rare.

I ran across one recently that was complaining about paredit mode. Which, admittedly, threw me for a loop when I ran across it the first time. I couldn’t understand how brilliant and wonderful it is until I’d written enough lisp to appreciate it.

Apparently, it’s the default mode in LightTable. Which, given its background, should be great as a beginner’s tool. The fact that it takes not-insignificant effort to switch to something that’s more immediately obvious to newbs (the “normal” thing where the closing parenthesis appears only and whenever you type it) doesn’t immediately and obviously counter the huge advantage you get by working with the actual tree structure of your code in a way that simply forbids creating unbalanced parentheses.

It’s something you need experience to appreciate.

I think that a lot of lisp is that way.

I won’t try to re-hash or top Paul Graham’s Blub Paradox. I’ll just state that I’ve seen it in action and fought many losing battles against it. Programmers generally don’t like getting pushed out of our comfort zones any more than anyone else. Many of us may intellectually accept that it’s a really good idea to learn a variety of languages for the sake of having a variety of tools in our box, but most of us never really have time to explore more than a sprinkling to any degree.

Even when we do, that sprinkling is likely to be C, C++, C#, Java, and javascript. Maybe python for the really adventurous. If you happened to take a beginner class centered around lisp, it was almost definitely scheme, and it probably left a foul taste in your mouth.

Arguably, scheme may be the perfect language for introducing beginners to the important concepts and moving straight into getting stuff done. I think python’s probably easier and better, because it has so many more batteries included, but that could very well just be my C++ bias. Either way, that foul taste is almost inevitable: if you try to graft useful appendages onto the flawless diamond that scheme is, you wind up with a ball of mud that resembles common lisp.

I’m starting to believe that lisp simply isn’t a good choice as a beginning programming language. You almost need to spend years coping with all the garbage that other languages dump on you before you can begin to see the benefits of a nice, clean language with a very regular syntax.

Even then, common lisp seems likely to be more attractive at first glance than something truly alien like clojure. The object orientation may be screwy, but it’s undeniably powerful. And any decent programmer worth his salt ought to be able to cope with mutating state.

Right?

I didn’t give clojure a fair shake until one road trip where I started designing my own language that I was planning to implement in common lisp. Three hours (and about 150 miles) later, I realized that clojure already had pretty much everything I wanted. Immutable state and ties to the JVM seemed like relatively small prices to pay for all those features I thought were really important to me.

I didn’t realize that those were two of its biggest strengths.

It’s tough enough to convince seasoned programmers that it’s worth exploring a language with screwy syntax and alien concepts. I can understand the temptation to inflict that on beginners, but it really seems to do more harm than good.

I know that I look back on my first language with contempt and disdain. (This is fair, since BASIC really isn’t good for much beyond teaching beginners).

Then again, there *are* the rare few who will recognize how much easier they had it back in the beginning and will be willing to try to push the rest of us to at least take a look at what we’re missing. But most of them will have forgotten the power they wielded as they grind down their spirits at the wheel of some enterprise language.

It’s probably kinder to just spare them that suffering and let them discover the worthwhile languages on their own. The ones who truly care about their craft will. The rest will keep going back to the enterprise languages no matter what.