Closer to "the human"? Do you know more than 3 people who know C++ operator precedence?
Humans don't handle operator precedence very well.
You don't have to know an entire operator precedence table to read and write idiomatic infix-notation code. Precedence is defined such that common expressions evaluate as people intuitively expect (a notable counterexample is "x & y == z" in C). Parentheses are always available to clarify more complicated expressions.
Come to think of it, humans usually add and subtract by stacking numbers vertically. I don't think you can point at infix notation as "the" human-friendly notation.
This feels like a discussion based in fiction...
(/ (+ (- b) (sqrt (- (* b b) (* 4 a c)))) (* 2 a)) ?
I take it you think there is something intrinsically wrong with that idea?
I find it very hard, without bracket counting, to see exactly what the '+' and '/' bind to. With the more traditional:
(-b + sqrt(bb-4ac)) / (2a)
I find in only a glance I can tell what everything is binding to.
It must be nice to live in a world with only 4 infix operators and expressions that have only 3 infix operators.
For example, lots of folks think that sqrt should be a prefix operator, not yet another function. I suppose you're going to assume that the top bar will serve as parentheses.
BTW "-b + sqrt(bb-4ac) / 2a" is the interesting expression. Is it "(-b + sqrt(bb-4ac)) / (2a)" or "-b + (sqrt(bb-4ac)) / 2a)" And, are you certain what "bb-4ac" means? (There's at least one major language where it doesn't mean "(bb)-(4ac)".)
And that's how the exceptions swallow the rule. And, it's also how we get infix programming languages where that's definitely not true, and so on. Where should we make the switch?
Also, only four? What about set operations?
(/ (- (sqrt (discriminant a b c)) b)
(* 2 a))Other notations are used, but with a frequency similar to pre-fix (lisp) and post-fix (forth). "Associativity" (not affected by order of evaluation) only makes sense for in-fix.
But it really could just be familiarity, I guess. I can't see how to determine it either way. But regardless of the cause, there's overwhelming evidence that people, in fact, prefer in-fix.
How many people have seen anything other than in-fix? Of those, how many got a fair shot at an alternative?
If it's "idiomatic", why is there such disagreement?
> Why then has math (which is read and written only by humans)
Convention has a lot of value. That said, mathematicians don't have to worry about getting things wrong. It's just paper, and they're happy to let humans fix up the errors.
> Parentheses are always available to clarify more complicated expressions.
Unnecessary parentheses are how humans deal with the fact that they can't handle infix.
here's IPL, an influence of lisp, also a list processing language (c/p from wikipedia)
IPL-V List Structure Example
Name SYMB LINK
L1 9-1 100
100 S4 101
101 S5 0
9-1 0 200
200 A1 201
201 V1 202
202 A2 203
203 V2 0
How human LISP feels now ;) ?