Created
September 12, 2016 19:04
-
-
Save zackdever/dce4edd205ea12db89124a411859f329 to your computer and use it in GitHub Desktop.
racey results from clojure.core.memoize
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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