Created
April 2, 2013 15:57
-
-
Save sudowork/5293377 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
; Creating maps | |
user=> {:one 1, :two 2 :three 3} ; Note: commas are treated as whitespace | |
{:one 1, :three 3, :two 2} | |
user=> (hash-map :one 1, :two 2) | |
{:one 1, :two 2} | |
; Accessing and using maps | |
user=> (def nums {:one 1, :two 2, :three 3}) ; Note: we introduce def to define/bind a variable | |
#'user/nums | |
user=> (nums :one) | |
1 | |
user=> (merge {:conflict 41} {:conflict 42, :noconflict 1337}) | |
{:noconflict 1337, :conflict 42} | |
user=> (merge-with * nums nums) | |
{:one 1, :three 9, :two 4} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment