[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: TYPES doesn't test COMPLEX
Date: Thu, 10 Dec 87 16:51:03 PST
From: raible%rodan.nas.nasa.gov%ngp.utexas.edu@RELAY.CS.NET L. Raible" <raible@rodan.nas.nasa.gov>
Message-Id: <8712110051.AA01105@rodan.nas.nasa.gov>
To: jeff%aiva.edinburgh.ac.uk@nss.cs.ucl.ac.uk
Cc: @sally.utexas.edu
In-Reply-To: Jeff Dalton's message of Thu, 10 Dec 87 23:50:10 GMT <14144.8712102350@aiva.ed.ac.uk>
Subject: TYPEP doesn't test COMPLEX
Received: from CSNet-Relay by utokyo-relay; 11 Dec 87 12:41:32-JST (Fri)
Status: R
From: Jeff Dalton <jeff%aiva.edinburgh.ac.uk@nss.cs.ucl.ac.uk>
Date: Thu, 10 Dec 87 23:50:10 GMT
(TYPEP x 'COMPLEX) always => NIL.
KCl (Kyoto Common Lisp) June 3, 1987
>(typep #c(1 1) 'complex)
NIL
This can be fixed as follows:
(setf (get 'complex 'type-predicate) 'complexp)
Jeff Dalton, JANET: J.Dalton@uk.ac.ed
AI Applications Institute, ARPA: J.Dalton%uk.ac.ed@nss.cs.ucl.ac.uk
Edinburgh University. UUCP: ...!ukc!ed.ac.uk!J.Dalton
of course this should have been
(setf (get 'complex 'si::type-predicate) 'complexp)
for people who live in the USER package.
There was a bug in the definition of the Lisp function TYPEP
in lsp/predlib.lsp. To fix the bug, replace the CASE clause
(complex
(and (complexp object)
(typep (realpart object) (car i))
(typep (imagpart object) (car i))))
with
(complex
(and (complexp object)
(or (null i)
(and (typep (realpart object) (car i))
(typep (imagpart object) (car i))))))
-- Taiichi