|
|
|
|
|
by klibertp
3863 days ago
|
|
Wait, why? Could you elaborate? How is: + 1 2
fundamentally different from: 1 2 +
? You just look for the operator on the other side of arguments.I know both prefix, postfix and "crazy infix" (J, some APL) languages and I really don't see a qualitative difference. Of course, after you overcome the initial hurdle and get used to the notation. EDIT: ok, J/K/APL are a special case and I shouldn't mention them. |
|
Can you parse the following easily?
c_z x * s_z y * s_y * c_y z * + c_x * c_z y * s_z x * - s_x * - d_z =
Compare that to the infix form:
d_z = c_x * (c_y * z + s_y * (s_z * y + c_z * x)) - s_x * (c_z * y - s_z * x)
With infix, the operator sits between its operands, so you can easily see what expression makes up the first operand, and which makes up the second: you just look to its left and its right. Postfix, however, requires you to read the entire expression, because the operator doesn't show which operands it has, they're just whatever the last two were, and those last two might themselves be complex expressions. This gets worse the longer the total length of the expression.
Postfix also suffers from not making it clear how many operands a given operator takes. With infix this is always clear.
I like postfix languages for their simplicity, but I refuse to pretend they are as easy to read as infix languages.
(example was taken from https://en.wikipedia.org/wiki/3D_projection#Perspective_proj...)