Created
March 25, 2010 12:53
-
-
Save anonymous/343522 to your computer and use it in GitHub Desktop.
This file contains 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 zipmap | |
"Returns a map with the keys mapped to the corresponding vals." | |
[keys vals] | |
(loop [map {} | |
ks (seq keys) | |
vs (seq vals)] | |
(if (and ks vs) | |
(recur (assoc map (first ks) (first vs)) | |
(next ks) | |
(next vs)) | |
map))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment