3 ms·
That is a completely wrong-headed view. There is no precedence there because there is no ambiguity. The parentheses in your example are the function call paren
by kazinator 6y ago
That is a completely wrong-headed view. There is no precedence there because there is no ambiguity. The parentheses in your example are the function call parentheses, not the optional grouping parentheses. They are mandatory.
There are some issues of associativity in the semantics of some Lisp functions. For instance we know that that the syntax (+ 1.0 2 3.0 4) is a list object containing certain items in a known order.
But how are they added? This could depend on dialect. I think in Common Lisp, the result has to be as if they were added left to right. When inexact numbers are present, it matters.
This isn't a matter of syntax; it's a semantic matter, which depends on the operator.
For instance in (- 1 2 3 4), the 2 3 4 are treated as subtrahends which are subtracted from the 1. But (- 2) means subtract 2 from 0.
In TXR Lisp, I allowed the expt operator to be n-ary: you can write (expt 2 3 4). But this actually means (expt 2 (expt 3 4)): it is a right to left reduction! It makes more sense that way, because it corresponds to:
4
3
2
The left-to-right interpretation would be
3 + 4
2
which is less useful: you can code that yourself using (expt 2 (+ 3 4)), for any number of additional terms after the 4.