Sam writes:
> > > I will write `type-eq', as we discussed in private, and put it into
> > > type.lisp
> > > (and pass it as :test to remove-duplicates)
> >
> > That's one possible optimization. Another approach is to write a general
> > `simplify-type' function, which would return
> > (OR (INTEGER -256 65535) CHARACTER)
>
> I would think that canonicalize-type should do this.
> it's non-recursive now, making it recursive for OR and AND would be a
> huge step forward.
canonicalize-type is only used by SUBTYPEP. Modifying canonicalize-type as
you point out would only make it slower, in many cases, for example
(subtypep '(unsigned-byte 8) '(or integer extended-char complicated-deftype))
does not need to expand all the parts of the second type in order to return
the correct result.
The ultimate canonicalize-type, if you need one, is described in Henry Baker's
paper gallery.
Bruno
|