Infix Versus Prefix Operators

Over at the Lisp subreddit, Combinatorilliance asks if there are any studies addressing the question of whether infix or prefix notation is easier to read and understand. There are, of course, fierce partisans on both sides of the question. We certainly hear lots of complaints from the anti-Emacs brigade about how hard Elisp is to read and in particular how prefix notation is an abomination.

I can read either notation with equal facility so I’m not going to enlist in either camp. At the end of the day, I’m pretty sure that it’s just a matter of what you’re used to. That gives the infix camp a huge advantage because, of course, we all learned to do arithmetic that way. But once you’ve used Elisp—or any Lisp—for a while you get used to prefix notation too and mostly don’t care which you’re reading.

I say “mostly” but truth to tell, I slightly prefer prefix. It is, after all, unambiguous and doesn’t require parenthesis that aren’t already there for other reasons. The precedence is always explicit. And an interesting, if anecdotal, data point is that Lisp originally envisioned an eventual infix notation but the original users liked and preferred S-expressions with their prefix notation.

As for Combinatorilliance’s question, it’s far too underspecified as stated. It’s like asking whether English or Italian is easier to read. You’ll get widely different answers if you ask the question in the United States or Italy. To be well-formed, the question would have to be something of the sort, “Do people with equal facility in reading infix and prefix find one or the other easier to read?” You can already see the problems. Now you have to have an reliable of measure of facility in reading the two notations and once you do, the question seems to lose some of it’s interest. Again, it will come down to a matter of preference rather than inherent lucidity.

Most Emacs users in a programming position are going to have to be adept at both notations so the whole thing boils down to just another holy war like Vim versus Emacs.

This entry was posted in General and tagged , . Bookmark the permalink.