3 ms·
Beware the number of evaluation dragons! 1 < x < 5 is not just syntactic sugar for 1 < x and x < 5. Every lisp macro programmer knows that x must be evaluated
by rurban 2y ago
Beware the number of evaluation dragons!
1 < x < 5 is not just syntactic sugar for 1 < x and x < 5.
Every lisp macro programmer knows that x must be evaluated only once, so it needs to be gensym'ed. Only if x is a constant or evaluates to itself it can be optimized without a gensym.
- kazinator 2y ago< is a function in Common Lisp and similar dialects, so that is moot. A reason to make it an operator is that short circuiting is a possibility. If (< 1 x) in (< 1 x y z), y and z need not be evaluated. A compiler which understands the semantics of < can do that anyway for the function, provided that no necessary side effects are elided. Like if evaluating y and z has no side effect other than preparing the operand (which still has a cost), that can be elided at least.