Skip to content

Instantly share code, notes, and snippets.

@zackdever
Created September 12, 2016 19:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zackdever/dce4edd205ea12db89124a411859f329 to your computer and use it in GitHub Desktop.
Save zackdever/dce4edd205ea12db89124a411859f329 to your computer and use it in GitHub Desktop.
racey results from clojure.core.memoize
(require '[clojure.core.memoize :as memo])
(defn calc [x] x)
(def memo-calc (memo/ttl calc {} :ttl/threshold 13))
(filter #(not= "ok" %)
(for [x (range 100000)]
(if (nil? (memo-calc "abc"))
(println "Result was nil!")
"ok")))
;Result was nil!
;Result was nil!
;Result was nil!
;(nil nil nil)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment