- (let* ((name (symbol-name pred))
- (stem (string-left-trim "%" (string-right-trim "P-" name)))
- (article (if (position (schar name 0) "AEIOU") "an" "a")))
- `(defun ,pred (object)
- ,(format nil
- "Return true if OBJECT is ~A ~A, and NIL otherwise."
- article
- stem)
- ;; (falling through to low-level implementation)
- (,pred object)))))
+ (let* ((name (symbol-name pred))
+ (stem (string-left-trim "%" (string-right-trim "P-" name)))
+ (article (if (position (schar name 0) "AEIOU") "an" "a")))
+ `(defun ,pred (object)
+ ,(format nil
+ "Return true if OBJECT is ~A ~A, and NIL otherwise."
+ article
+ stem)
+ ;; (falling through to low-level implementation)
+ (,pred object)))))
(def-type-predicate-wrapper array-header-p)
(def-type-predicate-wrapper arrayp)
(def-type-predicate-wrapper atom)
(def-type-predicate-wrapper base-char-p)
(def-type-predicate-wrapper base-string-p)
(def-type-predicate-wrapper array-header-p)
(def-type-predicate-wrapper arrayp)
(def-type-predicate-wrapper atom)
(def-type-predicate-wrapper base-char-p)
(def-type-predicate-wrapper base-string-p)
;; the type it tests for in the Common Lisp type system, and since it's
;; only used in the implementation of a few specialized things.)
(def-type-predicate-wrapper double-float-p)
;; the type it tests for in the Common Lisp type system, and since it's
;; only used in the implementation of a few specialized things.)
(def-type-predicate-wrapper double-float-p)
#!+long-float (def-type-predicate-wrapper simple-array-long-float-p)
(def-type-predicate-wrapper simple-array-complex-single-float-p)
(def-type-predicate-wrapper simple-array-complex-double-float-p)
#!+long-float (def-type-predicate-wrapper simple-array-long-float-p)
(def-type-predicate-wrapper simple-array-complex-single-float-p)
(def-type-predicate-wrapper simple-array-complex-double-float-p)
- (case name
- (sb!alien-internals:alien-value
- `(sb!alien:alien
- ,(sb!alien-internals:unparse-alien-type
- (sb!alien-internals:alien-value-type object))))
- (t
- (let ((pname (classoid-proper-name classoid)))
- (if (classoid-p pname)
- (classoid-pcl-class pname)
- pname))))
- name)))))
+ (case name
+ (sb!alien-internals:alien-value
+ `(sb!alien:alien
+ ,(sb!alien-internals:unparse-alien-type
+ (sb!alien-internals:alien-value-type object))))
+ (t
+ (let ((pname (classoid-proper-name classoid)))
+ (if (classoid-p pname)
+ (classoid-pcl-class pname)
+ pname))))
+ name)))))
- ((consp x)
- (and (consp y)
- (equal (car x) (car y))
- (equal (cdr x) (cdr y))))
- ((stringp x)
- (and (stringp y) (string= x y)))
- ((pathnamep x)
- (and (pathnamep y) (pathname= x y)))
- ((bit-vector-p x)
- (and (bit-vector-p y)
- (bit-vector-= x y)))
- (t nil)))
+ ((consp x)
+ (and (consp y)
+ (equal (car x) (car y))
+ (equal (cdr x) (cdr y))))
+ ((stringp x)
+ (and (stringp y) (string= x y)))
+ ((pathnamep x)
+ (and (pathnamep y) (pathname= x y)))
+ ((bit-vector-p x)
+ (and (bit-vector-p y)
+ (bit-vector-= x y)))
+ (t nil)))
- (eql (hash-table-count x) (hash-table-count y))
- (eql (hash-table-test x) (hash-table-test y))
- (block comparison-of-entries
- (maphash (lambda (key x-value)
- (multiple-value-bind (y-value y-value-p)
- (gethash key y)
- (unless (and y-value-p (equalp x-value y-value))
- (return-from comparison-of-entries nil))))
- x)
- t))))
+ (eql (hash-table-count x) (hash-table-count y))
+ (eql (hash-table-test x) (hash-table-test y))
+ (block comparison-of-entries
+ (maphash (lambda (key x-value)
+ (multiple-value-bind (y-value y-value-p)
+ (gethash key y)
+ (unless (and y-value-p (equalp x-value y-value))
+ (return-from comparison-of-entries nil))))
+ x)
+ t))))
- ((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)))
+ ((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)))
(/show0 "TEST-CASES bound in pred.lisp")
(dolist (test-case test-cases)
(/show0 "about to do a TEST-CASE in pred.lisp")
(destructuring-bind (x y expected-result) test-case
(let* ((result (equalp x y))
(/show0 "TEST-CASES bound in pred.lisp")
(dolist (test-case test-cases)
(/show0 "about to do a TEST-CASE in pred.lisp")
(destructuring-bind (x y expected-result) test-case
(let* ((result (equalp x y))
- (bresult (if result 1 0))
- (expected-bresult (if expected-result 1 0)))
- (unless (= bresult expected-bresult)
- (/show0 "failing test in pred.lisp")
- (error "failed test (EQUALP ~S ~S)" x y))))))
+ (bresult (if result 1 0))
+ (expected-bresult (if expected-result 1 0)))
+ (unless (= bresult expected-bresult)
+ (/show0 "failing test in pred.lisp")
+ (error "failed test (EQUALP ~S ~S)" x y))))))