[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: list type cleanup



While this seems to be useful functionality, there is a difference between the
LIST type specifiers and the ARRAY type specifiers in that the type of a LIST
object is mutable, e.g.,

(typep x '(list number))
(setf (car y) t)
(typep x '(list number))

is false, while normally, for built in type designators that do not involve
SATISFIES, no side effect operation (other than changing the direct binding of
X) can affect the value of TYPEP for that binding.


Given the mutability of the type designators, I question your assertion "There
is a need in common lisp for more accurate type specifiers
for lists."

I can believe there is a need for a general database interface, and also for a
portable window system.

However, I'm not sure I can admit to knowing what the need here is without some
examples of how it might be used, and where the proposed use is more reasonable,
efficient than the alternative  (would you advocate programers say

(typep x '(list number symbol)) instead of 
(and (listp x) (numberp (car x)) (symbolp (cadr x)))?

Should it check (null (cddr x))?

Should it be written

(and (consp x) (numberp (car x)) (consp (cdr x)) (symbolp (cadr x)) (null (cddr
x))) ?

I guess I would call it ADDITION instead of COMPATIBLE CHANGE. The distinction
between a CHANGE and an ADDITION in my mind is whether it makes the language
(its description and its implementation) smaller or larger.