4 ms·
(< a (>= b c)) same number of operators but a few extra parens
by davidrusu 12y ago
(< a (>= b c)) same number of operators but a few extra parens
- deleted 12y ago[deleted]
- Jach 12y agoThis isn't the same thing -- the Python syntax is asking for a < b and b >= c, while only evaluating b once. There are many infix math libraries for lisps (e.g. this one from 1995: https://www.cs.cmu.edu/afs/cs/project/ai-repository/ai/lang/lisp/code/syntax/infix/infix.cl https://www.cs.cmu.edu/afs/cs/project/ai-repository/ai/lang/...) that allow things like #I(a < b >= c), but the trick is only evaluating b once. (The linked lib will expand into two evaluations if b is an expression.)
- kazinator 12y agoHere (>= b c) will return a boolean value, which you're then comparing to a.
- kazinator 12y agoWhich means it could be done, but the relational operators (any one of which could be the leftmost constituent) have to all be defined as macros which analyze the rest of the expression with alternative evaluation rules.