6 ms·
Depending on how frequent are complex equations in your code, you could make a macro for it, and write it e.g. like this: (math 5 * f (x + 2)) I might be te
by Viliam1234 6y ago
Depending on how frequent are complex equations in your code, you could make a macro for it, and write it e.g. like this:
(math 5 * f (x + 2))
I might be tempted to do so if I frequently encountered math expressions of depth 3 or more, which in my short Lisp career I didn't.
Also, I would probably rewrite the expression as:
(* 5 (f (+ x 2)))
to make it easier to read by putting the simple operand first; or in case of two difficult operands I would use formatting:
(* (f (+ x 2))
(g (+ x 3)))
Note that a good editor would check that the parentheses match the formatting, so I wouldn't really count that 3 closing parentheses are needed in the last line; they would be inserted automatically.