[Openmcl-devel] defmethod parameter specializers

Duncan Rose duncan at robotcat.demon.co.uk
Fri Aug 12 23:34:38 UTC 2005


Is the following expected behaviour? I'm trying to create a method 
specialized on (to?) a multi-dimensional array of unspecified 
dimensionality:

CL-USER> (defgeneric my-test (collection))
#<STANDARD-GENERIC-FUNCTION MY-TEST #x6509B46>

CL-USER> (defmethod my-test ((collection t))
	   (format t "basic~%"))
#<STANDARD-METHOD MY-TEST (T)>

CL-USER> (defmethod my-test ((collection simple-array))
	   (format t "simple-array~%"))
#<STANDARD-METHOD MY-TEST (SIMPLE-ARRAY)>

CL-USER> (my-test #2A(('a 'b) ('c 'd)))
basic
NIL

CL-USER> (subtypep '(simple-array t (* *)) 'simple-array)
T
T
CL-USER> (typep #2A(('a 'b) ('c 'd)) 'simple-array)
T
CL-USER> (find-class 'simple-array)
#<BUILT-IN-CLASS SIMPLE-ARRAY>

CL-USER>


Shouldn't the call (my-test #2A(...)) invoke the method specializing 
the parameter to simple-array since simple-array is more specific than 
T?

I'm using 0.14.3 on 10.2

-Duncan




More information about the Openmcl-devel mailing list