Comment by neokantian
7 years ago
Yeah, Rich is obviously right. Concerning Clojure, or any Lisp variant for that matter, I came to realize that the cost of the unusual prefix notation -- which does cause inconvenience to people trained on using infix -- needs to be offset by the usefulness of defmacro, i.e. the possibility of using macros. Paul Graham insists that it is surely worth it, but unfortunately, he does not show convincing examples. So, I keep sitting on the fence. I am ready to be convinced, though, with compelling examples of a problem that I cannot possibly solve with defun and for which I would need defmacro.
> that I cannot possibly solve with defun and for which I would need defmacro
Well, defun is a macro: http://clhs.lisp.se/Body/m_defun.htm
The parenthesized prefix notation is advantageous because it is unambiguous and easy to format. People trained on infix still make mistakes due to associativity and precedence: mistakes in understanding an expression and in writing the correct expression which matches their intent. Their skill does not translate into unfamiliar languages that have unfamiliar operators with unfamiliar precedence and associativity rules.
The user of a Lisp benefits from the development which has gone into the language/implementation. That development is lubricated by the structure of the code. The Lisp programmer does not only write new macros, but uses existing ones, either in the language/implementation or third party libraries.
There is no problem you cannot possibly solve with defun (plus escape hatches to access any aspect of the host environment), because defun gives you access to a Turing -complete computation model.
This is simply not a genuinely honest way to evaluate tools. Gee, I'm not convinced that there is a text editing problem I can't possibly solve with ed if I bash at the keyboard long enough; so for now I will keep sitting on the fence.
possibly isn't easily, efficiently, maintainably, and so on.
> Paul Graham insists that it is surely worth it, but unfortunately, he does not show convincing examples [of the usefulness of macros].
Seriously? Are you suggesting On Lisp contains no convincing examples? It's what the whole book is about.
I think that programmers would generally be willing to overcome the inconvenience of the unusual notation, if the advantage of using defmacro was obvious from good examples to which they could, at least, relate. This question was also asked on stackoverflow: https://stackoverflow.com/questions/267862/what-makes-lisp-m.... My opinion is that the examples in the answers are neither obvious nor compelling. Hence, I am still waiting for better examples.