[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

LET-IF



    Date: Mon, 25 Nov 85 14:08 PST
    From: Richard Lamson <rsl@RUSSIAN.SPA.Symbolics.COM>

	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.

I can't imagine what LET-IF would mean with lexical variables
no matter what the implementation.