Re: doseq over atomic collection

2015-04-05 Thread Shahrdad Shadab
Thanks a lot James. It seems I completely missed the order of let and doseq. On Sun, Apr 5, 2015 at 1:12 PM, James Reeves wrote: > Dereferencing an atom will give you the value of the atom at the time you > dereferenced it. So at the start of the doseq loop, you deref the atom and > get back an

Re: doseq over atomic collection

2015-04-05 Thread James Reeves
Dereferencing an atom will give you the value of the atom at the time you dereferenced it. So at the start of the doseq loop, you deref the atom and get back an immutable vector of values. It's the same as writing: (let [data @a-data] (doseq [element data] ...)) You dereference

doseq over atomic collection

2015-04-05 Thread Shahrdad Shadab
Hi folks It may seem silly question but why when I doseq over a vector that is wrapped in an atom and change the vector using swap! while I am inside doseq, the doseq sets to the beginning of the vector intermittently: (def a-data (atom [15 9 8 1 4 11 7 12 13 14 5 3 16 2 10 6])) (defn switch-tw