Common Lisp the Language, 2nd Edition


next up previous contents index
Next: Predicating Type Specifiers Up: Type Specifiers Previous: Type Specifier Symbols

4.2. Type Specifier Lists

If a type specifier is a list, the car of the list is a symbol, and the rest of the list is subsidiary type information. In many cases a subsidiary item may be unspecified. The unspecified subsidiary item is indicated by writing *. For example, to completely specify a vector type, one must mention the type of the elements and the length of the vector, as for example

(vector double-float 100)

To leave the length unspecified, one would write

(vector double-float *)

To leave the element type unspecified, one would write

(vector * 100)

change_begin
One may also leave both length and element type unspecified:

(vector * *)
change_end

Suppose that two type specifiers are the same except that the first has a * where the second has a more explicit specification. Then the second denotes a subtype of the type denoted by the first.

As a convenience, if a list has one or more unspecified items at the end, such items may simply be dropped rather than writing an explicit * for each one. If dropping all occurrences of * results in a singleton list, then the parentheses may be dropped as well (the list may be replaced by the symbol in its car). For example, (vector double-float *) may be abbreviated to (vector double-float), and (vector * *) may be abbreviated to (vector) and then to simply vector.



next up previous contents index
Next: Predicating Type Specifiers Up: Type Specifiers Previous: Type Specifier Symbols


AI.Repository@cs.cmu.edu