[racket-dev] [Feature Request] for macro #:when clauses should bind their results if asked.

From: Eli Barzilay (eli at barzilay.org)
Date: Tue Sep 6 14:45:19 EDT 2011

Just now, Carl Eastlund wrote:
> You can also write:
> (for*/list ([(k v) (in-hash ht)]
>             [res (in-value (f k v))]
>             #:when res)
>   res)

[It does seem a little too verbose with the 3 mentions of `res', but
that's the same kind of verbosity as repeating `x' in:

  (for/list ([x (in-range 100 110)]) x)

If there was some rule like "with no body, the last bound loop
variable(s) is used", then this becomes

  (for/list ([x (in-range 100 110)]))

and the above:

  (for*/list ([(k v) (in-hash ht)]
              [res (in-value (f k v))]
              #:when res))


          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!

Posted on the dev mailing list.