The for form iterates by drawing an element from each sequence; if any
sequence is empty, then the iteration stops. So this:

(for ([i (in-range 2 4)]
       [j (in-range 1 2)])
 (printf "i = ~s   j = ~s\n" i j))

produces

i = 2   j = 1

at which point, the j sequence is now empty, so the entire iteration stops.

--- nadeem


On Fri, Dec 30, 2011 at 5:49 PM, Charles Turner <chtu...@gmail.com> wrote:
> I'm noticing some unexpected behaviour with in-range:
>
>> (for ([i (in-range 2 4)])
>  (printf "i = ~s\n" i))
> i = 2
> i = 3
>
> that works as expected, but:
>
>> (for ([i (in-range 2 4)]
>        [j (in-range 1 2)])
>  (printf "i = ~s\n" i))
> i = 2
>
> why isn't '3' being picked up in the second example?
>
> Thanks,
>       Charles.
> ____________________
>  Racket Users list:
>  http://lists.racket-lang.org/users

____________________
  Racket Users list:
  http://lists.racket-lang.org/users

Reply via email to