Martin Pool's blog

The Lisp Paradox

Paul Graham wrote a while ago on the idea that good programming languages are converging on Lisp.

In it, he presents a programming language elegance microbenchmark: write a function that returns a function that accumulates values. To some extent this is skewed towards Lisp — it's impossible to write at all in pure functional languages, despite that some people find them very valuable. And it's slightly artificial in Python: if you wanted to sum the values in some sequence, you'd just do it without using a function.

But still, it does show Python as a language is perhaps not quite so elegant as Lisp. I'm inclined to agree. And yet I find Python far more useful.

Though Paul didn't say so, I think his results demonstrate the big problem with lisp:

Lisp: Arc (def foo (n) [++ n _])

Lisp: Common Lisp (defun foo (n) (lambda (i) (incf n i)))

Lisp: Goo (df foo (n) (op incf n _))

Lisp: Scheme (define (foo n) (lambda (i) (set! n (+ n i)) n))

Four rather different definitions, all for a nearly-trivial function. (Four different spellings of a single keyword!) And this is just for a pure algorithm, with no consideration of how to make the program run, or how to print the results.

We may leave aside the experimental Arc and Goo dialects, or concentrate on only Scheme or CL, but allow for the different ways of launching various lisp interpreters and compilers on Linux and you're probably up to a dozen variations. The most basic thing for a Unix language is to have a "shebang" line that can go at the start of a program to make it executable, but Lisp/Scheme doesn't even standardize this.

And this is to say nothing of the libraries you might need to do something useful, like split a string or display a dialog or parse web input. Not only do the libraries differ, but even the syntax for loading a library differs.

Of course you could just pick one dialect, but which one? If you say "I'm using Foo Lisp" in particular then you're using a very unusual language, with corresponding worries about it being dropped or inadequately supported in the future. Sometimes it's worthwhile.

The Python solution to the benchmark is longer and slightly klunky compared to Lisp, but at least it will run everywhere Python runs, including under the CLR and the JVM. There is a single standardized method for calling this function from another program.

Peter Norvig (who knows infinitely more about Lisp than me) says

Python can be seen as either a practical (better libraries) version of Scheme, or as a cleaned-up (no $@&%) version of Perl.

Pathological variation is an endemic disease for Lisp: it's fun and easy to write an interpreter, so everyone does, producing a maze of incompatible versions, eternally irrelevant. I say that sadly, not triumphantly, because I would really like a good Lisp that was widely useful, but I don't expect to ever get it.

Archives 2008: Apr Feb 2007: Jul May Feb Jan 2006: Dec Nov Oct Sep Aug Jul Jun Jan 2005: Sep Aug Jul Jun May Apr Mar Feb Jan 2004: Dec Nov Oct Sep Aug Jul Jun May Apr Mar Feb Jan 2003: Dec Nov Oct Sep Aug Jul Jun May