[parenscript-devel] Loops that return a value

Boris Smilga boris.smilga at gmail.com
Tue Jan 15 15:29:44 UTC 2013


On Tue, Jan 15, 2013 at 2:17 PM, David Sargeant <david at dsargeant.com> wrote:

> It seems that the looping constructs don't currently return a value.  In
> other words, they don't return an array of the results.  CoffeeScript
> allows for both scenarios, that is, looping for side-effects and looping
> that returns an array of results.  I'm thinking it would be very useful to
> have dotimes*, dolist*, for-in*, etc. that return an array of results.
> Below is an example from coffeescript.org.  Let me know what you think.
>
>
> David
>
>
> countdown = (num for num in [10..1])
>
>
In Common Lisp—and Parenscript—that would be

  (loop for num :from 10 :to 1
    collect num)

Which expands to roughly the same JS code.

 — B. Smilga.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/parenscript-devel/attachments/20130115/d01cd94c/attachment.html>


More information about the parenscript-devel mailing list