Skip to content

Instantly share code, notes, and snippets.

@sudowork
Created April 2, 2013 15:57
Show Gist options
  • Save sudowork/5293377 to your computer and use it in GitHub Desktop.
Save sudowork/5293377 to your computer and use it in GitHub Desktop.
; 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