It is possible to give simple type declarations in LOOP thus:
(loop for i integer from 1 to 10 ...)
But is it possible to give more specific list type specifiers?
(loop for i (integer 1 10) from 1 to 10 ...)
Does not seem to work. If I read the spec correctly, the only
possibilities are typenames or lists of typenames.
From: Sam Steingold
Subject: Re: Loop type declaration
Date:
Message-ID: <ubr8pw37u.fsf@gnu.org>
> * Jacek Generowicz <················@prea.pu> [2005-04-08 20:02:52 +0200]:
>
> It is possible to give simple type declarations in LOOP thus:
>
> (loop for i integer from 1 to 10 ...)
(loop for i of-type integer from 1 to 10 collect i)
==> (1 2 3 4 5 6 7 8 9 10)
> But is it possible to give more specific list type specifiers?
>
> (loop for i (integer 1 10) from 1 to 10 ...)
(loop for i of-type (integer 1 10) from 1 to 10 collect i)
==> (1 2 3 4 5 6 7 8 9 10)
<http://www.lisp.org/HyperSpec/Body/mac_loop.html>
destructured-type-spec::= of-type d-type-spec
--
Sam Steingold (http://www.podval.org/~sds) running w2k
<http://www.honestreporting.com> <http://www.camera.org>
<http://www.palestinefacts.org/> <http://www.openvotingconsortium.org/>
Growing Old is Inevitable; Growing Up is Optional.
Sam Steingold <···@gnu.org> writes:
> (loop for i of-type (integer 1 10) from 1 to 10 collect i)
> ==> (1 2 3 4 5 6 7 8 9 10)
Doh! I completely failed to notice that "of-type" was a terminal.
Thanks.