Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
;variants of the code from point #2 of:
; http://www.tbray.org/ongoing/When/200x/2009/12/01/Clojure-Theses
;original
(apply merge-with +
(pmap count-lines
(partition-all *batch-size*
(line-seq (reader filename)))))
;pipelined style
(->> (line-seq (reader filename))
(partition-all *batch-size*)
(pmap count-lines)
(apply merge-with +))
;step-wise, with labeled interim results
(let [lines (line-seq (reader filename))
processed-data (pmap count-lines
(partition-all *batch-size* lines))]
(apply merge-with + processed-data))
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.