Yes, and that's the odd part, right? That this prefix notation is considered "natural" when there is lots of evidence that it isn't.
pow() is a good example, as it was used a lot as an example for operator overloading in, for example, Swift. So instead of
pow(2,x)
you can write
2 ** x
For many people, the latter seems to be more natural, and feels more "built in" on the one hand, but on the other hand having lots of weird combinations of special characters is somewhat unreadable.
If you extend infix syntax to named methods, the problem goes away:
2 raisedTo:x
So why is prefix function notation so popular? The only reason I can think of is that it mimics the function notation we learned in school: f(x). And I guess something can be said for separating the function from its arguments.
So in a sense I agree with you that the difference is not huge for some expressions, but for me that doesn't solve the mystery, but only shifts it.
For me it's just a matter of what you're used to. We're used to 2+2, and sin(x) so that's what we do. If you learned +(2,2) then that's what's more intuitive for you. And with time you get used to new approaches anyway.
Also, infix has the unfortunate problem of requiring operator priorities to parse.
Infix doesn't require operator precedence, it's just something we've adopted from math. Notice that you've flattened the parse tree in the second example. A fair comparison would be:
(2 f (3 g 4))
which is arguably how most sane engineers would write it.
pow() is a good example, as it was used a lot as an example for operator overloading in, for example, Swift. So instead of
you can write For many people, the latter seems to be more natural, and feels more "built in" on the one hand, but on the other hand having lots of weird combinations of special characters is somewhat unreadable.If you extend infix syntax to named methods, the problem goes away:
So why is prefix function notation so popular? The only reason I can think of is that it mimics the function notation we learned in school: f(x). And I guess something can be said for separating the function from its arguments.So in a sense I agree with you that the difference is not huge for some expressions, but for me that doesn't solve the mystery, but only shifts it.