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

From: J. Ian Johnson (ianj at ccs.neu.edu)
Date: Tue Jul 29 16:50:35 EDT 2014

I forgot that aspect of #:when and #:unless. Sorry for the noise.
-Ian
----- Original Message -----
From: "Sam Tobin-Hochstadt" <samth at cs.indiana.edu>
To: "J. Ian Johnson" <ianj at ccs.neu.edu>
Cc: "dev" <dev at racket-lang.org>
Sent: Tuesday, July 29, 2014 4:46:49 PM GMT -05:00 US/Canada Eastern
Subject: Re: [racket-dev] Surprising behavior of for/fold. Bug?

`#: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.