3 ms·
Well, the P in PEMDAS stands for 'brackets'. The clearest example, even though it's rather uncommon: a := x ** y ** z (and that's hoping the language does t
by tmtvl 8mo ago
Well, the P in PEMDAS stands for 'brackets'. The clearest example, even though it's rather uncommon:
a := x ** y ** z
(and that's hoping the language does the OOE for exponentiation arithmetically correctly) versus
(setf a (expt x (expt y z)))
It's a bit like how Reverse Polish Notation is superior to the infix notation we torture ourselves with (x + y * z or (x + y) * z versus x y z * + or x y + z *).
- Joker_vD 8mo agoBut that's just associativity, not the order of evaluation? E.g. in C# expressions are evaluated strictly left to right, so if it had operator **, the order of evaluation would've been: tmp1 := x, tmp2 := y, tmp3 := z, tmp4 := tmp2 ** tmp3, yield tmp1 ** tmp4 And, eh, I am not really that convinced that a b * c d * x y * z t * p q * + + sqrt + + is much less torturous than a * b + c * d + sqrt(x * y + z * t + p * q)