I have this piece of code:

(defn- run-work-elements-in-parallel
  "Runs a group of work elements in parallel. Returns an extended database."
  [elements database]
  (assert (set elements))
  (let [[rec simp] (separate :recursive elements)
        results-simp (pmap #(run-simple-work-element % database) simp)
        results-rec (map #(run-recursive-work-element % database) rec)
        results (concat results-simp results-rec)]
    (preduce union (cons database results))))

The exact details aren't important.

The let bindings results-simp, results-rec, and results are each a lazy
stream.  They can get quite large.  Assuming preduce can iterate over them,
is binding them in the let statement stopping them from getting garbage
collected?

If so, is the best solution to wrap them in a (fn [] ...) and then use them
like (results)?

Thanks

--~--~---------~--~----~------------~-------~--~----~
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
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to