;;; -*- Mode:Lisp; Readtable:ZL; Package:USER; Base:10; Patch-File:T -*-
;;; Patch file for System version 121.37
;;; Reason:
;;;  Make alternate macro definition for LET-IF (gag)
;;; Written 3-Mar-87 12:24:03 by jrm (Joe Marshall) at site LMI Cambridge
;;; while running on Lambda Four A from band 2
;;; with Experimental System 121.36, Experimental Lambda-Diag 15.0, Experimental ZMail 70.2, Experimental KERMIT 32.0, Experimental Unix-Interface 10.0, Experimental Local-File 72.0, Experimental FILE-Server 21.0, Experimental Tape 13.0, microcode 1742, SDU Boot Tape 3.14, SDU ROM 102, 121.35.



; From modified file DJ: L.SYS; EVAL.LISP#173 at 3-Mar-87 12:24:23
#10R SYSTEM-INTERNALS#: 
(COMPILER-LET ((*PACKAGE* (PKG-FIND-PACKAGE "SYSTEM-INTERNALS")))
  (COMPILER::PATCH-SOURCE-FILE "SYS: SYS; EVAL  "

(defmacro (let-if alternate-macro-definition) (condition binding-list &rest body)
  (let ((thunk (gensym)))
    (labels ((split-bindings (bindings variables values)
	       (if (null bindings)
		   `(LET ((,thunk ,@body))
		      (IF ,condition
			  (PROGV ,variables ,values (FUNCALL ,thunk))
			  (FUNCALL ,thunk)))
		   (let ((this-binding (first bindings)))
		     (split-bindings (rest bindings)
				     (cons (if (listp this-binding)
					       (first this-binding)
					       this-binding)
					   variables)
				     (cons (if (and (listp this-binding)
						    (cdr this-binding))
					       (second this-binding)
					       'nil)
					   values))))))
      (split-bindings binding-list '() '()))))

))

