[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
LET-IF
Date: Fri, 22 Nov 85 20:41:51 EST
From: "George J. Carrette" <GJC@MIT-MC.ARPA>
Funny you should mention that, I'm considering flushing quite a few
special forms in the LMI system and replacing them with macros, LET-IF
is one, and the following definition seems right:
(defmacro let-if (pred bindings &body body)
(let ((f (gentemp "f")))
`(flet ((,f () ,@body))
(if ,pred (let ,bindings (,f)) (,f)))))
Unfortunately, this doesn't work if you want the bindings to be lexical
instead of special bindings. Consider:
(defun xor (a b)
(let-if a ((b (not b)))
b))
Unless B is special, this won't work using your scheme.
- Follow-Ups:
- LET-IF
- From: Bernard S. Greenberg <BSG@SCRC-STONY-BROOK.ARPA>
- References:
- LET-IF
- From: "George J. Carrette" <GJC@MIT-MC.ARPA>