[racket] reference #:when clause in for/list?

From: Mark Wallace (lotabout at gmail.com)
Date: Sun Aug 17 08:14:14 EDT 2014

Thank Daniel and Sam!

Below is a little conclusion:

1. When it comes to "for*/list", "in-values" can be used to introduce 
bindings just like "let".

2. "filter-map" can be a great alternative when "for/list" is considered.

On 08/17/2014 07:59 PM, Sam Tobin-Hochstadt wrote:
> This is what 'in-value' is for.
>
> Sam
>
> On Aug 17, 2014 5:07 AM, "Mark Wallace" <lotabout at gmail.com
> <mailto:lotabout at gmail.com>> wrote:
>
>     Consider the following pseudocode:
>
>     (for/list ([i ...]
>                 #:when <very complecated expr E>)
>        <reference to the above expr E>)
>
>     Can I bind that expression E and reference in the body of "for/list"?
>
>     If expression E takes lots of time to finish, we would not want to
>     compute it again :).
>
>     I understand that there are workarounds like first collect all items
>     of expression E and then use 'filter' to get interested items.
>     However it would be a waste of memory if the number of interested
>     items is small.
>
>     So, any ideas?
>
>     --
>     Best Regards,
>     Mark Wallace.
>     ____________________
>       Racket Users list:
>     http://lists.racket-lang.org/__users
>     <http://lists.racket-lang.org/users>
>

-- 
Best Regards,
Mark Wallace.

Posted on the users mailing list.