Skip to content

Instantly share code, notes, and snippets.

@athos athos/retry.clj
Created Oct 12, 2016

Embed
What would you like to do?
(defn with-retry [n f]
(letfn [(try-once [i]
(try
(f)
(catch Exception e
(if (pos? i)
#(try-once (dec i))
(throw e)))))]
(trampoline try-once n)))
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.