Change unsyntaxing of conditionals to handle case of (if (not x) y)
authorChris Hanson <org/chris-hanson/cph>
Tue, 2 Jun 1987 11:24:27 +0000 (11:24 +0000)
committerChris Hanson <org/chris-hanson/cph>
Tue, 2 Jun 1987 11:24:27 +0000 (11:24 +0000)
correctly.

v7/src/runtime/unsyn.scm

index 4bbd10e6048cfad2545dc3242d6a40d5cf891cd4..5bd1b253acec7a81065d78486060b6dadfef2280 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;;    $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/runtime/unsyn.scm,v 13.45 1987/05/29 13:31:58 cph Exp $
+;;;    $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/runtime/unsyn.scm,v 13.46 1987/06/02 11:24:27 cph Exp $
 ;;;
 ;;;    Copyright (c) 1987 Massachusetts Institute of Technology
 ;;;
 
 (define (unsyntax-THE-ENVIRONMENT-object object)
   `(THE-ENVIRONMENT))
+
+(define (unsyntax-DISJUNCTION-object object)
+  `(OR ,@(disjunction-components object unexpand-disjunction)))
+
+(define (unexpand-disjunction predicate alternative)
+  `(,(unsyntax-object predicate)
+    ,@(if (disjunction? alternative)
+         (disjunction-components alternative unexpand-disjunction)
+         `(,(unsyntax-object alternative)))))
 \f
 (define (unsyntax-CONDITIONAL-object conditional)
   (conditional-components conditional unsyntax-conditional))
        ((eq? alternative undefined-conditional-branch)
         `(IF ,(unsyntax-object predicate)
              ,(unsyntax-object consequent)))
+       ((eq? consequent undefined-conditional-branch)
+        `(IF (,not ,(unsyntax-object predicate))
+             ,(unsyntax-object alternative)))
        ((conditional? alternative)
         `(COND ,@(unsyntax-cond-conditional predicate
                                             consequent
                                           consequent
                                           alternative))))))
       `(,(unsyntax-object predicate) ,(unsyntax-object consequent))))
-
-(define (unsyntax-DISJUNCTION-object object)
-  `(OR ,@(disjunction-components object unexpand-disjunction)))
-
-(define (unexpand-disjunction predicate alternative)
-  `(,(unsyntax-object predicate)
-    ,@(if (disjunction? alternative)
-         (disjunction-components alternative unexpand-disjunction)
-         `(,(unsyntax-object alternative)))))
 \f
 ;;;; Lambdas