Created
December 14, 2011 19:26
-
-
Save paulosuzart/1478068 to your computer and use it in GitHub Desktop.
Makes a clojure Map from a given coll.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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