[Ecls-list] Apparent bug in type derivation for TYPEP

Juan Jose Garcia-Ripoll juanjose.garciaripoll at gmail.com
Sun Jun 2 20:56:23 UTC 2013


On Sat, Jun 1, 2013 at 7:41 PM, Eric Marsden <eric.marsden at free.fr> wrote:

> > (lisp-implementation-version)
> "13.5.1"
> > (defun foo ()
>    (typep t 'boolean))
> FOO
> > (compile 'foo)
> ;;; OPTIMIZE levels: Safety=2, Space=0, Speed=3, Debug=0
> ;;;
> ;;; End of Pass 1.
> FOO
> NIL
> NIL
> > (foo)
> (T)    ;; <-- expected: T
>

Your expectation is bogus. TYPEP returns a logical true, which may be any
object that is not NIL. ECL translates (TYPEP X 'BOOLEAN) into (MEMBER X
'(NIL T)).

http://www.lispworks.com/documentation/HyperSpec/Body/f_typep.htm
http://www.lispworks.com/documentation/HyperSpec/Body/26_glo_g.htm#generalized_boolean

Juanjo

-- 
Instituto de Física Fundamental, CSIC
c/ Serrano, 113b, Madrid 28006 (Spain)
http://juanjose.garciaripoll.googlepages.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/ecl-devel/attachments/20130602/d9ae2b2f/attachment.html>


More information about the ecl-devel mailing list