Created
June 25, 2015 14:09
-
-
Save jjconti/054e15b5a9a07ecadf33 to your computer and use it in GitHub Desktop.
Clojure: access a map using a key as a function or the map as a function
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
user=> (def d {:a 1 :b 2 :c 3}) | |
#'user/d | |
user=> (:b d) | |
2 | |
user=> (d :b) | |
2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note: key has to be a keyword. If the key is, for example, and Integer. It can't be used as a function.