4 ms·
For writing a program, the s-expression form might become: (+ (* 2 (^ x 3)) (^ x 2) (- (* 5 x))) Whereas: 2*x^3 + x^2 - 5*x Wo
by zelphirkalt 3y ago
For writing a program, the s-expression form might become:
(+ (* 2 (^ x 3))
(^ x 2)
(- (* 5 x)))
Whereas:
2*x^3 +
x^2 -
5*x
Would probably error out in most languages, due to parsing issues and ambiguity. Even worse ambiguity, if you put the signs in front, as then every line could be an expression by itself:
2*x^3
+ x^2
- 5*x
Could be 3 expressions or 2 or 1.
- Tainnor 3y agoIt might do the wrong thing in some languages but wouldn't necessarily raise a compiler error, and I'm fairly certain e.g. sympy should have no issue with it.