Map returns a lazy sequence, the list of values is not realized yet, you need to consume the lazy seq to obtain the values.
You should use (doseq [f fetches-seq] (queue-copy-fetch f))) if you have only side effects to generate and do not care about reusing the values returned by queue-copy-fetch. doseq returns nil. If you need to reuse the results from the calls later, look at doall. This one will retain the head as in: (doall (map queue-copy-fetch fetches-seq)) It takes some time to get used to lazy sequences. Look carefully at the API doc to spot fns that return lazy sequences. It's not because the REPL gives an output that you are not dealing with a lazy sequence. The REPL will consume the lazy seq if it's the last result available and walk through it to print you an output. Luc P. On Wed, 14 Sep 2011 22:39:42 -0700 (PDT) "c.taylor" <colin.tay...@gmail.com> wrote: > 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))))) > > > -- Luc P. ================ The rabid Muppet -- 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