Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
(defn get-instance [m k]
(if (contains? @m k) (get @m k)
(dosync
(if-let [v (get m k)] v
(let [newV (create-some-instance)]
(alter m assoc k newV)
newV)))))
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.