Map is lazy so it only gets called when you need something from the sequence. To force it to be called you use doall so it would be (doall (map queue-copy-fetch fetches-seq)).
You only need the do sequence in queue-copy-fetch but not in process-indexes. Matt Hoyt ________________________________ From: c.taylor <colin.tay...@gmail.com> To: Clojure <clojure@googlegroups.com> Sent: Thursday, September 15, 2011 12:39 AM Subject: confusion with map and dosync I'm sure this is very straightforward but can someone enlighten me why queue copy fetch is seemingly never called from within process-indexes (the 'pre add' line is printed but the 'adding' debug line is never printed). I've verified the correct contents of fetches-seq. For a bonus point can I ask if need the dosync inside q-c-f if its only ever called from p-i ? Any comments on style appreciated too. (defn- queue-copy-fetch [cfetch] (println "adding " cfetch) (dosync (alter copy-fetch-queue conj cfetch))) (defn process-indexes [] (while (seq @index-process-queue) (let [an-index (qpop index-process-queue) index-source (:source (:fetch an-index)) index-content (:doc-seq an-index) links-seq ((:copy-link-selector index-source) index-content) fetches-seq (map (partial fetch index-source) links-seq)] (println "pre add") (dosync (map queue-copy-fetch fetches-seq))))) -- 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 -- 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