From 822288f48033eea937bf3aef766306a594cc51e0 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Sat, 20 Nov 1993 21:33:38 +0000 Subject: [PATCH] Rearrange order of predicate testing in EQUAL? to favor more common types. --- v7/src/runtime/equals.scm | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/v7/src/runtime/equals.scm b/v7/src/runtime/equals.scm index c1bb2052d..42902f1fb 100644 --- a/v7/src/runtime/equals.scm +++ b/v7/src/runtime/equals.scm @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Id: equals.scm,v 14.5 1993/10/10 08:33:30 cph Exp $ +$Id: equals.scm,v 14.6 1993/11/20 21:33:38 cph Exp $ Copyright (c) 1988-93 Massachusetts Institute of Technology @@ -57,21 +57,9 @@ MIT in each case. |# (define (equal? x y) (or (eq? x y) (if (object-type? (object-type x) y) - (cond ((cell? y) - (equal? (cell-contents x) (cell-contents y))) - ((pair? y) + (cond ((pair? y) (and (equal? (car x) (car y)) (equal? (cdr x) (cdr y)))) - ((string? y) - (string=? x y)) - ((bit-string? y) - (bit-string=? x y)) - ((number? y) - (and (= x y) - (boolean=? (exact? x) (exact? y)))) - ((pathname? x) - (and (pathname? y) - (pathname=? x y))) ((vector? y) (let ((size (vector-length x))) (and (fix:= size (vector-length y)) @@ -80,6 +68,18 @@ MIT in each case. |# (and (equal? (vector-ref x index) (vector-ref y index)) (loop (fix:+ index 1)))))))) + ((string? y) + (string=? x y)) + ((number? y) + (and (= x y) + (boolean=? (exact? x) (exact? y)))) + ((cell? y) + (equal? (cell-contents x) (cell-contents y))) + ((bit-string? y) + (bit-string=? x y)) + ((pathname? x) + (and (pathname? y) + (pathname=? x y))) (else false)) (and (number? x) (number? y) -- 2.25.1