Given the map:
(def myMap {"a" 1 "b" 2 "c" 3 "d" 4 "e" 5 "f" 6})
I wish to use let to bind each key to each value. What is the most concise way to do this?
Given the map:
(def myMap {"a" 1 "b" 2 "c" 3 "d" 4 "e" 5 "f" 6})
I wish to use let to bind each key to each value. What is the most concise way to do this?
 
    
    with myMap as declared, destructuring of string keys seems like the best bet:
(let [{:strs [a b c d e f]} myMap] 
    (println a b c d e f))
;=> 1 2 3 4 5 6
 
    
    You can use desctructuring:
I would suggest first to convert all keys to keywords using custom function like this:
(defn keywordize [map]
  (into {} 
    (for [[k v] map]
      [(keyword k) v])))
And then use destructuring:
(let [{:keys [a b c d e f]} (keywordize myMap)]
  (println a b c d e f))
