[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Question about declaration
- To: RWK@YUKON.SCRC.Symbolics.COM
- Subject: Question about declaration
- From: firstname.lastname@example.org
- Date: Mon, 4 Jan 88 11:27 est
- Cc: email@example.com, firstname.lastname@example.org, CL@ACORN.CS.ROCHESTER.EDU
Yes, but you haven't really declared those values, have you?
All you've done is declare that you can have a "list of them".
Now, if there was a "sequence-enumerated" type (as we have
in our UIMS), this would be a different matter. I.e.
(function foo ((and list (sequence-enumerated
symbol integer symbol integer)))
(values &rest (and list (sequence-enumerated
symbol integer symbol integer))))
But what you'd *like* to know here is that the individual elements are
(function foo ((list integer))
(values &rest (list integer)))
where the new argument to LIST does *NOT* work like ARRAY (meaning "a kind of
list specialized to contain only integers"), but rather means "a list whose
elements are all INTEGER's".
There is a big gap between being able to declare the existence of
a variable number of arguments or values and being able to declare
It is possible to define (deftype LIST-OF (ty) ...) such that
(function foo (&rest (list-of integer)) (values &rest (list-of fixnum))))
makes sense. This can't be done in the normal way with
SATISFIES, but can be done by consing up a gensym and attaching the
list-of predicate to it. This is one of the uglier kludges in Common
Lisp, since it is a workaround for the lack of parameterized types.
The unresolved and truly ambiguous problem is whether &REST LIST means
that the rest arg is a list (as usual) or that the elements of the
&REST arg are lists.
Another ambiguity is whether returning type T allows the returning
of any number of values, i.e., is T > (values T T), or
T > (values &rest T).