[racket] reference #:when clause in for/list?
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.