From: Aaron Larson
Subject: common lisp type specifier for user defined aggregates
Date: 
Message-ID: <374bqv$5j9@moon.src.honeywell.com>
I would like to be able to define a type specifier for a user defined
aggregate which specifies the type of the elements of the aggregate.  For
example:

   (declare (type (bag-of integer) x))

Where 'bag-of' (or just 'bag') is some user defined type which contains
elements, in this case declared to be of type 'integer'.  I can see no
portable way to do this in common lisp.  Part of the problem is that the
specification of when the forms in a DEFTYPE are evaluated, is not clearly
specified in the dpANS3 document.

Ideally, this would be solved by something like:

  (deftype bag-of (&optional element-type)
    `(and bag (satisfies ,#'(lambda (x)
    				(every-element-of-bag-is-of-type `',element-type)))))

Except of course you have to have a symbol as the argument of SATISFIES.
Clearly the body of the deftype could, as a side effect, establish a
function binding for a symbol, and insert that symbol in the satisfies, but
can I be gauranteed that the body of the deftype, and hence the side
effect, will be executed in both the compiler and load time environments?