Created
June 13, 2013 20:31
-
-
Save vilmibm/5777085 to your computer and use it in GitHub Desktop.
might need this
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 list-to-map | |
"Given a list and a function that computes a key for a given list | |
item, return a map of key -> list item" | |
[key-fn lst] | |
(into {} (set (map (fn [item] [(key-fn item) item]) lst)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment