[racket-dev] Surprising behavior of for/fold. Bug?

From: Sam Tobin-Hochstadt (samth at cs.indiana.edu)
Date: Tue Jul 29 16:46:49 EDT 2014

`#:when` and `#:unless` introduce nesting, a la `for/fold*`. So yes,
you should expect this.

Sam

On Tue, Jul 29, 2014 at 1:23 PM, J. Ian Johnson <ianj at ccs.neu.edu> wrote:
> This will eat all your memory,
>
> (for/list ([x '(0 1 2 3 4 5 6)]
>            #:unless (= x 4)
>            [i (in-naturals)])
>   x)
>
> and this won't.
>
> (for/list ([x '(0 1 2 3 4 5 6)]
>            [i (in-naturals)]
>            #:unless (= x 4))
>   x)
>
> Should we expect this behavior? I was really surprised by this.
> -Ian
> _________________________
>   Racket Developers list:
>   http://lists.racket-lang.org/dev

Posted on the dev mailing list.