Skip to content

Instantly share code, notes, and snippets.

@amalloy
Created September 30, 2011 05:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amalloy/1252810 to your computer and use it in GitHub Desktop.
Save amalloy/1252810 to your computer and use it in GitHub Desktop.
(defn my-memo [f]
(let [cache (atom {})]
(fn [& args]
(force (get (swap! cache update-in [args]
#(or % (delay (apply f args))))
args)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment