5 ms·
I have wondered if not postfix is more suitable for writing math expressions. Yes, for simple expressions like 2*3+4 postfix is cumbersome, but for more complic
by bjourne 9y ago
I have wondered if not postfix is more suitable for writing math expressions. Yes, for simple expressions like 2*3+4 postfix is cumbersome, but for more complicated ones I think it has benefits. F.e: "k fac ln 2 ^ -1 ^" would be "1/ln(k!)^2"
It is easy to see that the postfix expression is just a composition of a bunch of functions "fac ln 2 ^ -1 ^", but not so easy in the infix case. It is also easy to derive the inverse of it: "-1 ^ 1/2 ^ exp fac^-1"
- Grustaf 9y agoWith infix notation you can clearly group terms and factors in your head. Postfix makes it almost impossible.
- contravariant 9y agoI'm fairly sure infix notation is easier to read for associative operations. It's hard to beat the simplicity of a + (b + c) = (a + b) + c. I'm also not convinced that (a x n ^ *) is going to catch on as a replacement for ax^n. I think some kind of postfix notation could be nice for category theory though, it always confuses me that X -f-> Y -g-> Z is a diagram for gf, not fg.