Skip to content

Instantly share code, notes, and snippets.

@latompa
Created September 20, 2012 19:55
Show Gist options
  • Save latompa/3757969 to your computer and use it in GitHub Desktop.
Save latompa/3757969 to your computer and use it in GitHub Desktop.
simple dictionary without using hashmap
(defn new-dict
[x]
'nil)
(defn add-to-dict
[dict key val]
#(if (= key %) val (dict %)))
(def mydict (add-to-dict (add-to-dict new-dict "b" 42) "a" 10))
(mydict "b")
(mydict "a")
(mydict "c")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment