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

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

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

Posted on the dev mailing list.