4 ms·
Traditional mathematical notation has precedence rules optimized for expressing polynomials. Programming languages- especially in the APL family- tend to have a
by RodgerTheGreat 3y ago
Traditional mathematical notation has precedence rules optimized for expressing polynomials. Programming languages- especially in the APL family- tend to have a richer collection of primitive verbs, and an "ideal" tower of binding precedence for all of them would be extremely complex, difficult to remember, and often unhelpful.
Unform evaluation order is much easier to remember and extend (no special cases!) and becomes even more natural than PEMDAS with a little practice. The APL family is hardly unique in this approach to precedence: Smalltalk has uniform infix precedence, Forths are uniformly postfix (unless you get goofy with parsing words), Lisps are uniformly prefix.
- fiddlerwoaroof 3y agoIMO, infix operators in math are a historical relic of function notation being developed after the basic operators became widespread. I’ve always thought uniform prefix notation is ideal, whether it’s lisp-style (+ 1 x y) or the more common +(1, x, y)