Skip to content

Instantly share code, notes, and snippets.

@paulosuzart
Created December 14, 2011 19:26
Show Gist options
  • Save paulosuzart/1478068 to your computer and use it in GitHub Desktop.
Save paulosuzart/1478068 to your computer and use it in GitHub Desktop.
Makes a clojure Map from a given coll.
(defn mkhash
"Makes a clojure map from a given collection. C should have an even
number of elements"
[c]
{:pre [(even? (count c))]}
(loop [m {} coll c]
(if (empty? coll)
m
(recur
(assoc m (first coll) (second coll))
(nnext coll)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment