I'm using re-frame, and I have a bind an atom to my-collection like this:
my-collection (atom {:one [] :two [] :three [] :four [] :five [] :six [] :seven [] :eight []})
Then I dispatch it to assoc to db and later, I will subscribe to it to use in a doseq like this:
(doseq [each (:one my-collection)]
(if)
(if)
(if)
)
Ther are now 8 doseq which I'm trying to put it on maybe a loop to avoid writing long doseq for 8 times. How can I do that?
I've tried this but it does not work:
(let [parts [:one :two :three :four :five :six :seven :eight]
index (atom 0)]
(loop [each ((nth parts @index) my-collection)]
(do
(if (= :one (nth parts @index)
some code)
(if (= :four (nth parts @index)
some code)
(if (= :eight (nth parts @index)
some code)
(swap! index inc)
(recur (nth parts @index))
)
)
)
Update:
I also need to use the keywords from parts, inside each if.