3 ms·
TXR Lisp has iflet, whenlet and condlet built in. They are used in places in the standard library. A bunch of occurrences (of all three!) are in the compiler, f
by kazinator 8y ago
TXR Lisp has iflet, whenlet and condlet built in. They are used in places in the standard library. A bunch of occurrences (of all three!) are in the compiler, for example:
http://www.kylheku.com/cgit/txr/tree/share/txr/stdlib/compiler.tl http://www.kylheku.com/cgit/txr/tree/share/txr/stdlib/compil...
Note that they all support multiple bindings, but not the and semantics: only the last binding is tested. Treating a nil value out of any of the bindings as a failure is way too constraining.
It is also permissible to omit the variable name from the last binding; in that case the expression is used as the controlling expression; e.g.
(whenlet ((a (expr1))
(b (expr2))) ;; we can delete b, if not needed
...)
Therefore, this is possible:
(whenlet ((x (expr1))
(y (expr2))
...
((complex-expr x y ...)))
...)
That is, bind some variables (that may or may not be nil: they are not being tested), and then reference them in a complex test expression.