Raffael Cavallaro <raffaelcavallaro@...> writes:
> * (defstruct (v3 (:type (vector double-float 3)))
> x y z)
> Is this a valid type specifier for defstruct?
CLtS on DEFSTRUCT is confused. In the "Arguments and Values" section,
it specifies that the type-option is of the form (:type foo), where
one of the type specifiers list, vector, or (vector size), or some
other type specifier defined by the implementation to be
In the main body ("Description") section, however, it states that the
:type should be
This produces the same result as specifying (vector t). The
structure is represented as a general vector, storing
components as vector elements. The first component is vector
element 1 if the structure is :named, and element 0 otherwise.
The structure is represented as a (possibly specialized)
vector, storing components as vector elements. Every component
must be of a type that can be stored in a vector of the type
specified. The first component is vector element 1 if the
structure is :named, and element 0 otherwise. The structure
can be :named only if the type symbol is a subtype of the
The structure is represented as a list. The first component is
the cadr if the structure is :named, and the car if it is not
I believe that it's fairly clear that the "Arguments and Values"
section is in error here, and that the only valid syntax for compound
vector types is (vector element-type) -- in this case, (vector
double-float) -- and that (vector double-float 3) is non-conforming
syntax. Whether CLISP and LispWorks are non-conforming in not
signalling an error is not clear.