Skip to content

Instantly share code, notes, and snippets.

View mtm's full-sized avatar

Mike T. Miller mtm

  • Sarasota, FL
View GitHub Profile
@mtm
mtm / progress.clj
Created May 11, 2012 18:08 — forked from kriyative/progress.clj
First cut implementation of `with-progress` and `report!`
(def ^{:dynamic true} *print-progress* true)
(defmacro with-progress
"Bind a `reportfn` function, and evaluate `body` wherein
calling (report!) will invoke the report function with the current
state of the iteration."
[reportfn & body]
`(let [iter# (atom 0)
reporter# ~reportfn]
(letfn [(~'report! []