[Openmcl-devel] deftype bug?

Paul Krueger plkrueger at comcast.net
Wed Mar 17 13:45:03 PDT 2010


The following looks like a bug to me. It is a much-simplified example  
of what I encountered. Shouldn't the use of "list" as part of the type  
definition preclude the error that occurs? CLTL is very explicit about  
that, but I couldn't find corresponding language in the hyper-spec, so  
perhaps something changed along the way. Note that using "cons"  
instead  of "list" works as expected.

I also upgraded to 1.5-dev-r13523M-trunk and got the same result. Am I  
missing something?

Paul

Welcome to Clozure Common Lisp Version 1.5-dev-r13388M-trunk   
(DarwinX8664)!
? (defun length3 (thing)
     (eql (list-length thing) 3))
LENGTH3
? (deftype list3 ()
     '(and list (satisfies length3)))
LIST3
? (deftype lst3 ()
     '(and cons (satisfies length3)))
LST3
? (setf arr (make-array '(3)))
#(0 0 0)
? (typep arr 'lst3)
NIL
? (typep arr 'list3)
 > Error: value #<SIMPLE-VECTOR 3> is not of the expected type LIST.
 > While executing: LIST-LENGTH, in process Listener(6).
 > Type cmd-. to abort, cmd-\ for a list of available restarts.
 > Type :? for other options.
1 > (typep arr 'list)
NIL



More information about the Openmcl-devel mailing list