RosettaCodeData/Task/Extend-your-language/Common-Lisp/extend-your-language.lisp
Ingy döt Net 764da6cbbb CDE
2013-04-10 16:57:12 -07:00

9 lines
329 B
Common Lisp

(defmacro if2 (cond1 cond2 both first second &rest neither)
(let ((res1 (gensym))
(res2 (gensym)))
`(let ((,res1 ,cond1)
(,res2 ,cond2))
(cond ((and ,res1 ,res2) ,both)
(,res1 ,first)
(,res2 ,second)
(t ,@neither)))))