Hacker News new | past | comments | ask | show | jobs | submit login

(< a (>= b c)) same number of operators but a few extra parens



This 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/...) 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.)


Here (>= b c) will return a boolean value, which you're then comparing to a.


Which 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: