You're viewing version 1.2.0 of hash-map. The latest stable version of Clojure Core is 1.3.0.
1.2.0 Arrow_down_16x16

hash-map

clojure.core

  • (hash-map)
  • (hash-map & keyvals)
keyval => key val
Returns a new hash map with supplied mappings.

2 Examples top

  • user=> (hash-map)
    {} 
    
    ;; sending a key more times, will remap it to the last value
    user=> (hash-map :key1 1, :key1 2) 
    {:key1 2} 
    
    user=> (hash-map :key1 'val1, 'key2 :val2, [:compound :key] nil)
    {[:compound :key] nil, :key1 val1, key2 :val2} 
    
    
  • user=> (map #(hash-map % 0) (seq "abcdefgh"))
    ({\a 0} {\b 0} {\c 0} {\d 0} {\e 0} {\f 0} {\g 0} {\h 0}) 
    
    user=> (apply hash-map (.split "a 1 b 2 c 3" " "))
    {"a" "1", "b" "2", "c" "3"}
Log in to add / edit an example.

See Also top

Log in to add a see also.

Comments top

No comments for hash-map. Log in to add a comment.