[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gcl-devel] Re: subtypep bug?
From: |
Camm Maguire |
Subject: |
[Gcl-devel] Re: subtypep bug? |
Date: |
15 Mar 2006 19:06:19 -0500 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 |
Greetings!
Thanks for the checking code. Confirmed here too.
interpreted-function and interpreted-function-p are now in si.
Take care,
Robert Boyer <address@hidden> writes:
> > Should be fixed now ... (subtypep (type-of object) (class-of object))
>
> Yes. Very fine. Thanks.
>
> Just for laughs. I computationally just checked this fact, that
>
> (subtypep (type-of object) (class-of object))
>
> for every object that was accessible from any symbol, descending through
> conses and arrays, but not structures.
>
> I suspect that you are aware that the type 'interpreted-function is not
> official ANSI, and so probably the symbol should be in some other package,
> along with 'interpreted-function-p.
>
> Bob
>
> -------------------------------------------------------------------------------
>
> (defparameter *okh* (make-hash-table :test 'eq))
>
> (defun test (x) (subtypep (type-of x) (class-of x)))
>
> (defun ok (x)
> (cond ((gethash x *okh*) t)
> (t (setf (gethash x *okh*) t)
> (cond ((not (test x))
> (error "~a failed the test" x))
> ((arrayp x)
> (loop for i below (array-total-size x)
> always (ok (row-major-aref x i))))
> ((atom x)
> (cond ((typep x
> '(or interpreted-function ; ? package
> si::s-data
> standard-generic-function
> standard-class
> built-in-class
> standard-method
> structure-class
> restart
> compiler::info
> ansi-loop::loop-universe
> pcl::cache
> pcl::pv-table
> pcl:funcallable-standard-class
> pcl::slot-class
> pcl::initialize-info
> pcl::standard-method-combination
> pcl:standard-effective-slot-definition
> symbol string number readtable
> character hash-table
> random-state pathname
> compiled-function
> package stream))
> t)
> (t (error "Unknown type. ~a ~a" x (type-of x)))))
> (t (and (ok (car x)) (ok (cdr x))))))))
>
> (defun chk-all ()
> (with-package-iterator (next-symbol (list-all-packages)
> :internal :external)
> (loop
> (multiple-value-bind (more? symbol) (next-symbol)
> (cond (more?
> (ok (symbol-plist symbol))
> (ok (symbol-name symbol))
> (ok (symbol-package symbol))
> (cond ((boundp symbol)
> (ok (symbol-value symbol))))
> (cond ((fboundp symbol)
> (ok (symbol-function symbol)))))
> (t (return)))))))
>
>
>
--
Camm Maguire address@hidden
==========================================================================
"The earth is but one country, and mankind its citizens." -- Baha'u'llah