> When you put the :while at the `x` clause you get the expected empty
> seq.
>
> user=> (for [x (range 1 10) :while (= x 2) y (range 1 10)] [x y])
> ()

Interesting, I didn't know that.

Still, the behavior of :while feels strange. I guess I'll get used to it.

In the following example :while and :when are interchangeable, which
is often the case when :while is used last in the list comprehension:

user=> (for [x (range 1 10) y (range 1 10) :while (< (+ x y) 5)] [x y])
([1 1] [1 2] [1 3] [2 1] [2 2] [3 1])

user=> (for [x (range 1 10) y (range 1 10) :when (< (+ x y) 5)] [x y])
([1 1] [1 2] [1 3] [2 1] [2 2] [3 1])

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to