Lisp - The Ducati Of Programming Languages

Monday, January 29, 2007

Introduction

One of the early summer evenings of 2003 I was sitting with a group of friends on a terrace of a lively New York City cafe. The wretched east coast humidity didn't yet settle in and we were enjoying a pleasant warm breeze while watching the flickering lights of cars pass by across the street. The guy sitting next to me was someone I haven't met before - a friend of a friend who happened to join us that evening. He was wearing a motorcycle jacket and had a helmet resting on his lap. Breaking the ice, I asked the first question that came to mind: "So what's it like to ride a bike?" I was genuinely interested but didn't expect to hear anything new. I would be unable to convey to someone the feeling of driving a car so how could I expect him to convey the feeling of riding a bike? A single experience would be worth a thousand words. His answer surprised me.

"When you drive a car", he said, "there is a disconnect between your thoughts and the machine. You sense it, but you're never really conscious of it until you get a bike. You want the car to accelerate, you add some gas, and then you have to wait for a split second before the car listens to you. On a bike this delay is so much smaller, your brain doesn't really register it. You think of something, and you're there. A bike becomes a part of you - an extension of your body. You'll probably need a Ferrari to achieve such unity with a car."

Then and there I made a resolution to one day learn to ride a motorcycle (first I'd need to get some free time and figure out how to keep it secret from my mom). I thought about the philosophy of mind/machine unity for a few more days until other thoughts took over and the conversation was gradually forgotten.

Common Lisp

Learning Haskell was like tackling a new rock climbing track - a slow, challenging, strenuous, yet an extremely satisfying process. When I finally got to a stable spot where I could get some rest I felt euphoric. To keep my neural pathways from irreversibly solidifying on Hindley-Milner way of thought I decided to take temporary leave from Haskell. The next couple of weeks I spent hacking in Common Lisp.

One day I mentioned what I've been doing to a friend over lunch. He never understood my affection for "weird" languages - few people ever do. "So what's it like to program in Lisp, anyway?" he asked. Suddenly the three year old analogy was snatched from the dark depths of my memory. "It's like riding a bike", I said.

A Common Lisp compiler is not just a tool - once you acquire a critical mass of knowledge it becomes an extension of mind and body. You think of where you want to be and a few keystrokes later you're there. Your mind doesn't have enough time to notice the delay. Hacking Lisp programs is such a fluid process that it's hard to think of the machine as an external entity. Common Lisp is the Ducati of programming languages.

Haskell

When my friend heard the analogy he asked a followup question. "If Lisp is the Ducati, then what is Haskell?" I'm glad he asked it - a newcomer to Haskell, formulating the response helped me drop the final piece of the puzzle in place in my own mind.

After some thinking I realized that the transportation analogy doesn't extend to Haskell in a meaningful way. Hacking Haskell programs is not like driving - the fluidity aspect is missing. Lisp lets you think any thoughts and instantaneously communicate them to the machine. Haskell provides a productivity boost in a very different way. It forces you to examine and rearrange the way you think about the problem every step of the way. Lack of fluidity is made up for by architectural guidance. It takes extra effort to write Haskell programs that aren't beautiful.

What should you learn first, Lisp or Haskell? It depends entirely on your personality. One thing is certain - if you want to be a great developer eventually you'll have to learn both.

Comments?

If you have any questions, comments, or suggestions, please drop a note at coffeemug@gmail.com. I'll be glad to hear your feedback.