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

A type specifier question for the CL language theorists.

    Date: Mon, 14 May 90 11:20 PDT
    From: RDP@ALAN.kahuna.decnet.lockheed.com (Robert D. Pfeiffer)

    I just realized that I don't know how to write a type specifier that
    concerns itself with the types of the elements of a list.  That is, I
    can write '(ARRAY INTEGER) to specify an array that consists of
    integers but I can't write '(LIST INTEGER) to do the same for lists.  

    Am I missing something obvious, or is there really no standard CL way to
    do this?

There is no standard CL way to do this.  The primary reason this exists
for arrays is because most implementations have specialized
representations of arrays with restricted element types (for instance,
(array (unsigned-byte 8)) can be implemented by packing four bytes into
a word and using byte addressing, rather than as an array of pointers as
in the general case), and code generation for array accessors can take
advantage of compile-time knowledge of the storage type.  Lists are less
amenable to such storage optimization, since they still have to have the
cdr pointer (even in cdr-coded implementations they have to have a
full-sized car pointer that can be replaced with a forwarding pointer
when you rplacd).

By the way, general Common Lisp questions are better off being sent to
the common-lisp@sail.stanford.edu mailing list, rather than the slug
mailing list.  The latter is more oriented towards Symbolics- and
user-group-specific discussions.