#| -*-Scheme-*-
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/runtime/equals.scm,v 14.2 1989/10/26 06:46:03 cph Rel $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/runtime/equals.scm,v 14.3 1991/01/31 07:08:51 hal Exp $
Copyright (c) 1988, 1989 Massachusetts Institute of Technology
;; numbers specially, but it turns out that EQ? does the right thing
;; for everything but numbers, so we take advantage of that.
(or (eq? x y)
- (and (object-type? (object-type x) y)
- (if (number? y)
- (and (= x y)
- (boolean=? (exact? x) (exact? y)))
- (and (object-type? (ucode-type vector) y)
- (zero? (vector-length x))
- (zero? (vector-length y)))))))
+ (if (object-type? (object-type x) y)
+ (if (number? y)
+ (and (= x y)
+ (boolean=? (exact? x) (exact? y)))
+ (and (object-type? (ucode-type vector) y)
+ (zero? (vector-length x))
+ (zero? (vector-length y))))
+ (and (number? x)
+ (number? y)
+ (= x y)
+ (boolean=? (exact? x) (exact? y))))))
(define (equal? x y)
(or (eq? x y)
- (and (object-type? (object-type x) y)
- (cond ((number? y)
- (and (= x y)
- (boolean=? (exact? x) (exact? y))))
- ((object-type? (ucode-type list) y)
- (and (equal? (car x) (car y))
- (equal? (cdr x) (cdr y))))
- ((object-type? (ucode-type vector) y)
- (let ((size (vector-length x)))
- (and (= size (vector-length y))
- (let loop ((index 0))
- (or (= index size)
- (and (equal? (vector-ref x index)
- (vector-ref y index))
- (loop (1+ index))))))))
- ((object-type? (ucode-type cell) y)
- (equal? (cell-contents x) (cell-contents y)))
- ((object-type? (ucode-type character-string) y)
- (string=? x y))
- ((object-type? (ucode-type vector-1b) y)
- (bit-string=? x y))
- (else false)))))
\ No newline at end of file
+ (if (object-type? (object-type x) y)
+ (cond ((number? y)
+ (and (= x y)
+ (boolean=? (exact? x) (exact? y))))
+ ((object-type? (ucode-type list) y)
+ (and (equal? (car x) (car y))
+ (equal? (cdr x) (cdr y))))
+ ((object-type? (ucode-type vector) y)
+ (let ((size (vector-length x)))
+ (and (= size (vector-length y))
+ (let loop ((index 0))
+ (or (= index size)
+ (and (equal? (vector-ref x index)
+ (vector-ref y index))
+ (loop (1+ index))))))))
+ ((object-type? (ucode-type cell) y)
+ (equal? (cell-contents x) (cell-contents y)))
+ ((object-type? (ucode-type character-string) y)
+ (string=? x y))
+ ((object-type? (ucode-type vector-1b) y)
+ (bit-string=? x y))
+ (else false))
+ (and (number? x)
+ (number? y)
+ (= x y)
+ (boolean=? (exact? x) (exact? y))))))
\ No newline at end of file