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

From: Mark Wallace (lotabout at gmail.com)
Date: Sun Aug 17 05:03:53 EDT 2014

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.

Posted on the users mailing list.