Lisp has too many parentheses…

…or so they say! And you know what people? Your language has too many variations and rules in it. They’re too complicated, and your weirdo representations of programs with { } and [ ] and ; and tabs and operator precedences and all that other junk is horrifically stunting your language.

What is Lisp? The LISt Processor I’ve heard.

Nope. Lisp doesn’t even have lists. Would you say C has lists? No. You can of course make lists in C, but you’re really just juggling pointers below a few abstractions you made. Does Python have lists? I guess so. They have a separate data type called “list” and is a fundamental structure in the sense that it’s not built up by anything else.

Lisp is kind of the same as C. There are no lists. All we have are cells and atoms. Let’s denote the set of cells by $C$ and atoms by $A$. Cells are just pairs of either other cells or atoms. What kind of structural things can we do with cells? Well, let $p=(x,y)$ be a cell.

We can get the first part of $p$. Let’s call this part the anterior region. To get the Cell’s Anterior Region, we write $\operatorname{car} p = x$. We can get the second part of the cell. Let’s call this part the dorsal region (why not posterior? The meaning of dorsal makes more sense with lists, in that the dorsal region of a list $[1,2,3]$ is the part “near the end”, $[2,3]$, whereas the posterior would just be $3$). To get the Cell’s Dorsal Region, we’ll write $\operatorname{cdr} p = y$. We can take two things, and construct a cell out of them. We’ll write $\operatorname{cons}(x,y)=(x,y)$.

We can easily “emulate” lists by having a special atom $\Lambda$ for empty lists, and then having special cells of the form $(x,y)$ where $x$ is a cell or atom and $y$ is $\Lambda$ or itself one of these special cells. Let’s call these special cells (as well as $\Lambda$) links and denote them $L$ So, \[(a,((x,(y,(z,\Lambda))),(c,(1,(2,(3,\Lambda))))))\] is a list. For simplicity, let’s use the notation \[ [a,[x,y,z],c,1,2,3]. \] So we know with Lisp’s basic construct, we can make things that resemble lists. They are, however, still just cells.

As said, all of Lisp is constructed by these cells and atoms, and usually come in the form of lists (since a lot of data is aggregate). However, this is not what Lisp is, it is just what it is made of. I am a human made of cells and atoms (albeit a different type of cell and atom), but it is not who I am nor what I represent. I am just represented by atoms and cells.

So then, what is Lisp?

Well, it is a sort of tree that lives and thrives in an artificial world, and are consumed by these creatures called Evals (pronounced roughly like “eh-vulz” as in “bevels”) and, unlike the natural process of digestion here on Earth, the Evals give us back another tree (depending on the environment it’s in).

A tree is an object with an operator or root and operands or leaves. Consider $2+6$. Itself, this not-yet-computed computation is a tree whose root is $+$ and whose leaves are $2$ and $6$. Feed this to an Eval and it will return to you a nice lump of $8$. Feed him $2+\text{bone}$, and the poor thing probably won’t be able to digest it and either choke until you revive it or die.

Anyway, these Evals eat these trees of the species Lisp. More (or perhaps less?) concretely, these trees are merely abstract representations of a kind of structure. A Lisp program, when sitting in memory, is just a structure. Of course we have a useful way to represent these programs so they can be communicated by us humans. We cannot see Lisp in its native form. We can, however, see a projection of Lisp in the form of characters, which we are all too familiar with. The projections look something like this:



(DEFUN DIFF (EXPR X) (COND ((EQUAL EXPR X) 1) ((EQUAL (CAR EXPR) 'PLUS) (LIST 'PLUS (DIFF (CADR EXPR) X) (CADDR EXPR) X)) ((EQUAL (CAR EXPR) 'TIMES) (LIST 'PLUS (LIST 'TIMES (CADR EXPR) (DIFF (CADDR EXPR) X)) (LIST 'TIMES (DIFF (CADR EXPR) X) (CADDR EXPR)))) (T 0)))

I hear what you’re going to say already.

See?! Too many parentheses!

However, this is not Lisp. A picture of the Eiffel Tower is not the Eiffel Tower. It is just a depiction of it. Therefore, saying Lisp has too many parentheses is like saying the Eiffel Tower has too much ink, when you’re just looking at a photograph of it.

The reason these projections of Lisp have so many parentheses is because it’s very simple. They all stem from one simple syntax:

(operator operand-1 operand-2 ...)

Now, keep in mind the image of Lisp has syntax, not Lisp itself. It is a way to describe what the Evals eat; Evals don’t literally eat our descriptions. They eat the trees we describe.

What makes Lisp beautiful then? I mean, the real actual Lisp Lisp, not the way we describe it with parentheses.

Well, since Lisp is something I can only show you pictures of, it’s very hard to explain why it is beautiful. You have to experience it for yourself. A photograph of Paris won’t replace the experience of drinking the wine or smelling the bread from within the streets. I can give a little “taste” however.

Going back to our discussion of cells, Lisp trees are built up from these cells. We represent the trees as lists. $[1,2,3]$ translates to (1 2 3) , etc. And we know how these lists are built from cells: $[1,2,3]=(1,(2,(3,\Lambda)))$, which in turn translates to (1 . (2 . (3 . NIL))) , and therefore (1 2 3) is really just shorthand for (1 . (2 . (3 . NIL))) .

So where’s the beauty?

Well those structural operations on cells also have their Lisp equivalents:

$\operatorname{car} p$ is just (car p) ,

, $\operatorname{cdr} p$ is just (cdr p) , and

, and $\operatorname{cons} (x,y)$ is just (cons x y) .

I’m still not seeing anything remarkable.

Well, the operations on cells are built up from cells themselves. (cons x y) is just (cons . (x . (y . NIL))) . So these inherently datum-like objects — lists, cells, atoms, trees — are also code objects. And they can mix and mingle and act on each other. This is why Lisp is called the programmable programming language.

Oh, and I might add, those Evals are just eval in Lisp and when they eat a tree called tree , one writes (eval tree) ; Eval, as well as the concept of an Eval “eating”, is just made of the same stuff the trees are made of: atoms and cells.

This post was inspired by this Usenet post, which talks about generally the same thing, but in a much different fashion. Highly recommend.