- ((characterp x) (and (characterp y) (char-equal x y)))
- ((numberp x) (and (numberp y) (= x y)))
- ((consp x)
- (and (consp y)
- (equalp (car x) (car y))
- (equalp (cdr x) (cdr y))))
- ((pathnamep x)
- (and (pathnamep y) (pathname= x y)))
- ((hash-table-p x)
- (and (hash-table-p y)
- (hash-table-equalp x y)))
- ((typep x 'instance)
- (let* ((layout-x (%instance-layout x))
- (len (layout-length layout-x)))
- (and (typep y 'instance)
- (eq layout-x (%instance-layout y))
- (structure-classoid-p (layout-classoid layout-x))
- (do ((i 1 (1+ i)))
- ((= i len) t)
- (declare (fixnum i))
- (let ((x-el (%instance-ref x i))
- (y-el (%instance-ref y i)))
- (unless (or (eq x-el y-el)
- (equalp x-el y-el))
- (return nil)))))))
- ((vectorp x)
- (let ((length (length x)))
- (and (vectorp y)
- (= length (length y))
- (dotimes (i length t)
- (let ((x-el (aref x i))
- (y-el (aref y i)))
- (unless (or (eq x-el y-el)
- (equalp x-el y-el))
- (return nil)))))))
- ((arrayp x)
- (and (arrayp y)
- (= (array-rank x) (array-rank y))
- (dotimes (axis (array-rank x) t)
- (unless (= (array-dimension x axis)
- (array-dimension y axis))
- (return nil)))
- (dotimes (index (array-total-size x) t)
- (let ((x-el (row-major-aref x index))
- (y-el (row-major-aref y index)))
- (unless (or (eq x-el y-el)
- (equalp x-el y-el))
- (return nil))))))
- (t nil)))
+ ((characterp x) (and (characterp y) (char-equal x y)))
+ ((numberp x) (and (numberp y) (= x y)))
+ ((consp x)
+ (and (consp y)
+ (equalp (car x) (car y))
+ (equalp (cdr x) (cdr y))))
+ ((pathnamep x)
+ (and (pathnamep y) (pathname= x y)))
+ ((hash-table-p x)
+ (and (hash-table-p y)
+ (hash-table-equalp x y)))
+ ((%instancep x)
+ (let* ((layout-x (%instance-layout x))
+ (raw-len (layout-n-untagged-slots layout-x))
+ (total-len (layout-length layout-x))
+ (normal-len (- total-len raw-len)))
+ (and (%instancep y)
+ (eq layout-x (%instance-layout y))
+ (structure-classoid-p (layout-classoid layout-x))
+ (dotimes (i normal-len t)
+ (let ((x-el (%instance-ref x i))
+ (y-el (%instance-ref y i)))
+ (unless (or (eq x-el y-el)
+ (equalp x-el y-el))
+ (return nil))))
+ (if (zerop raw-len)
+ t
+ (raw-instance-slots-equalp layout-x x y)))))
+ ((vectorp x)
+ (let ((length (length x)))
+ (and (vectorp y)
+ (= length (length y))
+ (dotimes (i length t)
+ (let ((x-el (aref x i))
+ (y-el (aref y i)))
+ (unless (or (eq x-el y-el)
+ (equalp x-el y-el))
+ (return nil)))))))
+ ((arrayp x)
+ (and (arrayp y)
+ (= (array-rank x) (array-rank y))
+ (dotimes (axis (array-rank x) t)
+ (unless (= (array-dimension x axis)
+ (array-dimension y axis))
+ (return nil)))
+ (dotimes (index (array-total-size x) t)
+ (let ((x-el (row-major-aref x index))
+ (y-el (row-major-aref y index)))
+ (unless (or (eq x-el y-el)
+ (equalp x-el y-el))
+ (return nil))))))
+ (t nil)))