I find the :while modifier non intuitive
user= (for [x (range 1 10) y (range 1 10) :while (= y 2)] [x y])
()
user= (for [x (range 1 10) y (range 1 10) :while (= x 2)] [x y])
([2 1] [2 2] [2 3] [2 4] [2 5] [2 6] [2 7] [2 8] [2 9])
My (false) intuition told me that both expressions would have
On Mon, Aug 3, 2009 at 2:47 AM, Jonasjonas.enl...@gmail.com wrote:
I find the :while modifier non intuitive
user= (for [x (range 1 10) y (range 1 10) :while (= y 2)] [x y])
()
user= (for [x (range 1 10) y (range 1 10) :while (= x 2)] [x y])
([2 1] [2 2] [2 3] [2 4] [2 5] [2 6] [2 7] [2 8]
Hi,
On Aug 3, 8:47 am, Jonas jonas.enl...@gmail.com wrote:
I find the :while modifier non intuitive
user= (for [x (range 1 10) y (range 1 10) :while (= y 2)] [x y])
()
user= (for [x (range 1 10) y (range 1 10) :while (= x 2)] [x y])
([2 1] [2 2] [2 3] [2 4] [2 5] [2 6] [2 7] [2 8] [2 9])
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
Hi,
Am 03.08.2009 um 16:56 schrieb Jonas Enlund:
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]