The optional arguments of deftype
deftype can be used to create user-defined types that expand into built-in types. For example:
(deftype octet-vector (length) `(simple-array (unsigned-byte 8) (,length)))
Given this deftype, in a type context, (octet-vector 32) expands into (simple-array (unsigned-byte 8) (32)), or a one-dimensional octet array of length 32.
Lambda lists for deftype are very similar to lambda lists for defmacro, with an important difference: where optional arguments to defmacro with no initialization form default to nil, the default value in deftype is the symbol *. The deftype above could be rewritten to take advantage of this:
(deftype octet-vector (&optional length) `(simple-array (unsigned-byte 8) (,length)))
Now, in a type context, a plain octet-vector expands into (simple-array (unsigned-byte 8) (*)), or a one-dimensional octet array of indeterminate length, and (octet-vector 32) expands into (simple-array (unsigned-byte 8) (32)).
For more information, see section 3.4.8, Deftype Lambda Lists.