[racket] generating 0 or more than 1 additions in the body of for/list, for/vector, for/hash

From: harsha reddy (wembdnow at gmail.com)
Date: Fri Apr 15 15:46:11 EDT 2011

Thanks for all the quick replies! I've been using for/fold till now and was
planning to use concatenation. (Indeed, append makes it more readable). The
for*/list and the sequence solutions also seem to be what I was looking for
as they seem to be avoid iterating twice and should be easy to convert to
for-mul/list, for-mul/hash macros which directly allow the body to return 0
or more additions.
On Fri, Apr 15, 2011 at 3:11 PM, harsha reddy <wembdnow at gmail.com> wrote:

> When using  the various versions of for like for/list; I often encounter
> situations where the body must not add any value to put into the generated
> list  (useful when one needs to filter and map simultaneously) or must
> generate more than value. I guess the way to do this would be to treat the
> result of the body as a list of additions and then concatenate all these
> lists. Something similar would be needed for for for/hash(taking care of the
> multiple values issue),for/and, for/vector etc.
>   I just wanted to know, because this seems like a common enough situation,
> if there are some standard commands or libraries which implement the
> modified versions of these commands.
> thanks,
> Harsha
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20110415/0330e204/attachment.html>

Posted on the users mailing list.