On Mon, Oct 10, 2011 at 1:07 PM, Lee Spector <lspec...@hampshire.edu> wrote:
> Here's my stab at doing this using agents:
>
> (defn pmapall
>  "Like pmap but: 1) coll should be finite, 2) the returned sequence
>   will not be lazy, 3) calls to f may occur in any order, to maximize
>   multicore processor utilization, and 4) takes only one coll so far."
>  [f coll]
>  (let [agents (map agent coll)]
>    (dorun (map #(send % f) agents))
>    (apply await agents)
>    (doall (map deref agents))))

What you're really looking for is pdoseq, right? Seems like futures
might be a better building-block for this, although again Clojure's
lack of flexibility over the thread pool could easily bite you here.

-Phil

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

Reply via email to