[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: (typep 3 'complex) => t
- To: RAM@C.CS.CMU.EDU
- Subject: Re: (typep 3 'complex) => t
- From: Masinter.pa@Xerox.COM
- Date: Sun, 23 Nov 1986 19:38:00 -0000
- Cc: common-lisp@SU-AI.ARPA
- In-reply-to: Rob MacLachlan <RAM@C.CS.CMU.EDU>'s message of Sun, 23 Nov 86 17:32 EST
why don't you use
(deftype complex-number (&optional type)
(if type `(or ,type (complex ,type))
'(or rational complex)))
e.g., (declare (type complex-number x))
means that either X is strictly complex or else a rational, while
(declare (type (complex-number fixnum) x)
means that either X is a fixnum or a (complex fixnum).
It seems well within the bounds of the Common Lisp framework to use
deftype to add types that are interesting to some compilers, without
requiring that the types be added to every other implementation.