From: Chris Hanson Date: Tue, 16 Dec 1986 19:36:45 +0000 (+0000) Subject: Convert `or' to `if' where the value is a boolean. X-Git-Tag: 20090517-FFI~13807 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=2fc8a31db5fdc03c8bd68f27b856eeee8e74c011;p=mit-scheme.git Convert `or' to `if' where the value is a boolean. --- diff --git a/v7/src/runtime/equals.scm b/v7/src/runtime/equals.scm index d0fe71468..79029e8ff 100644 --- a/v7/src/runtime/equals.scm +++ b/v7/src/runtime/equals.scm @@ -37,6 +37,8 @@ ;;;; Equality +;;; $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/runtime/equals.scm,v 1.10 1986/12/16 19:36:12 cph Exp $ + (declare (usual-integrations)) (let-syntax ((type? @@ -50,7 +52,7 @@ ;; numbers specially, but it turns out that EQ? does the right thing ;; for everything but numbers, so we take advantage of that. (if (eq? x y) - #T + true (and (primitive-type? (primitive-type x) y) (or (type? big-fixnum y) (type? big-flonum y)) @@ -58,7 +60,7 @@ (define (equal? x y) (if (eq? x y) - #T + true (and (primitive-type? (primitive-type x) y) (cond ((or (type? big-fixnum y) (type? big-flonum y)) @@ -69,7 +71,8 @@ ((type? vector y) (let ((size (vector-length x))) (define (loop index) - (or (= index size) + (if (= index size) + true (and (equal? (vector-ref x index) (vector-ref y index)) (loop (1+ index))))) diff --git a/v7/src/runtime/list.scm b/v7/src/runtime/list.scm index 4941e9cd8..23475858c 100644 --- a/v7/src/runtime/list.scm +++ b/v7/src/runtime/list.scm @@ -18,9 +18,9 @@ ;;; future releases; and (b) to inform MIT of noteworthy uses of ;;; this software. ;;; -;;; 3. All materials developed as a consequence of the use of -;;; this software shall duly acknowledge such use, in accordance -;;; with the usual standards of acknowledging credit in academic +;;; 3. All materials developed as a consequence of the use of this +;;; software shall duly acknowledge such use, in accordance with +;;; the usual standards of acknowledging credit in academic ;;; research. ;;; ;;; 4. MIT has made no warrantee or representation that the @@ -28,7 +28,7 @@ ;;; under no obligation to provide any services, by way of ;;; maintenance, update, or otherwise. ;;; -;;; 5. In conjunction with products arising from the use of this +;;; 5. In conjunction with products arising from the use of this ;;; material, there shall be no use of the name of the ;;; Massachusetts Institute of Technology nor of any adaptation ;;; thereof in any advertising, promotional, or sales literature @@ -37,6 +37,8 @@ ;;;; List Operations +;;; $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/runtime/list.scm,v 1.64 1986/12/16 19:36:45 cph Exp $ + (declare (usual-integrations)) ;;; This IN-PACKAGE is just a kludge to prevent the definitions of the @@ -55,9 +57,9 @@ elements) (define (list? frob) - (or (null? frob) - (and (pair? frob) - (list? (cdr frob))))) + (cond ((null? frob) true) + ((pair? frob) (list? (cdr frob))) + (else false))) (define (cons* first-element . rest-elements) (define (loop this-element rest-elements) @@ -252,9 +254,10 @@ (define (for-all? predicate) (define (loop objects) - (or (not (pair? objects)) + (if (pair? objects) (and (predicate (car objects)) - (loop (cdr objects))))) + (loop (cdr objects))) + true)) loop) ;;;; Generalized List Operations @@ -328,14 +331,14 @@ ((positive-list-searcher (lambda (items) (predicate (car items))) car - #!FALSE) + false) list)) (define (list-search-negative list predicate) ((negative-list-searcher (lambda (items) (predicate (car items))) car - #!FALSE) + false) list)) ;;;; Membership Lists @@ -344,7 +347,7 @@ ((positive-list-searcher (lambda (sub-list) (pred (car sub-list) element)) identity-procedure - #!FALSE) + false) list)) ;(define memq (member-procedure eq?)) @@ -363,14 +366,14 @@ (define delq! (delete-member-procedure list-deletor! eq?)) (define delv! (delete-member-procedure list-deletor! eqv?)) (define delete! (delete-member-procedure list-deletor! equal?)) - + ;;;; Association Lists (define ((association-procedure pred selector) key alist) ((positive-list-searcher (lambda (sub-alist) (pred (selector (car sub-alist)) key)) car - #!FALSE) + false) alist)) ;(define assq (association-procedure eq? car))