Skip to content

Instantly share code, notes, and snippets.

@cmeiklejohn
Created November 10, 2012 03:22
Show Gist options
  • Save cmeiklejohn/4049721 to your computer and use it in GitHub Desktop.
Save cmeiklejohn/4049721 to your computer and use it in GitHub Desktop.
(defn threshold
([thr call-fn]
#(threshold thr 1 call-fn))
([thr cur call-fn]
(if (> cur thr)
(do (apply call-fn [])
#(threshold thr call-fn))
#(threshold thr (inc cur) call-fn))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment