[parenscript-devel] Loops that return a value
Daniel Gackle
danielgackle at gmail.com
Tue Jan 15 20:27:19 UTC 2013
> That code doesn't work properly in parenscript, btw. It does not
decrement.
PS's LOOP works just like CL's in this respect, so what Boris meant to
say was :DOWNTO rather than :TO. There are four options here. :TO and
:DOWNTO are inclusive, while :BELOW and :ABOVE are exclusive:
(loop :for num :from 1 :to 10 :collect num)
=> (1 2 3 4 5 6 7 8 9 10)
(loop :for num :from 10 :downto 1 :collect num)
=> (10 9 8 7 6 5 4 3 2 1)
(loop :for num :from 1 :below 10 :collect num)
=> (1 2 3 4 5 6 7 8 9)
(loop :for num :from 10 :above 1 :collect num)
=> (10 9 8 7 6 5 4 3 2)
Daniel
On Tue, Jan 15, 2013 at 1:18 PM, David Sargeant <david at dsargeant.com> wrote:
> That code doesn't work properly in parenscript, btw. It does not
> decrement.
>
> (function () {
> var collect66 = [];
> for (var num = 10; num <= 1; num += 1) {
> collect66['push'](num);
> };
> return collect66;
> })();
>
> _______________________________________________
> parenscript-devel mailing list
> parenscript-devel at common-lisp.net
> http://lists.common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/parenscript-devel/attachments/20130115/cf8de759/attachment.html>
More information about the parenscript-devel
mailing list