Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
(defn unordered-pmap [threads f in-c out-c]
(let [remain (atom threads)]
(dotimes [x threads]
(go-loop []
(if-some [v (<! in-c)]
(do (>! out-c (f v))
(recur))
(if (zero? (swap! remain dec))
(close! out-c)))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.