RosettaCodeData/Task/Extend-your-language/TXR/extend-your-language.txr
2015-11-18 06:14:39 +00:00

9 lines
325 B
Text

(defmacro if2 (cond1 cond2 both first second . neither)
(let ((res1 (gensym))
(res2 (gensym)))
^(let ((,res1 ,cond1)
(,res2 ,cond2))
(cond ((and ,res1 ,res2) ,both)
(,res1 ,first)
(,res2 ,second)
(t ,*neither)))))