-
-
Save anonymous/b75be902b2b578e2e55b to your computer and use it in GitHub Desktop.
This file contains 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
(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