Skip to content

Instantly share code, notes, and snippets.

@the-frey
Last active August 12, 2019 16:52
Show Gist options
  • Save the-frey/a1e0fbebecd67b009b689a864ef8eec4 to your computer and use it in GitHub Desktop.
Save the-frey/a1e0fbebecd67b009b689a864ef8eec4 to your computer and use it in GitHub Desktop.
;; example vector
(def test-vec [["1" "foo"]["2" "bar"]])
;; via reduce, the verbose way
(reduce (fn [acc i] (assoc acc (first i) (second i))) {} test-vec)
;; also via reduce, the terse way
(reduce conj {} test-vec)
;; via a handy built-in
(into {} test-vec)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment