Skip to content

Instantly share code, notes, and snippets.

@razum2um
Created October 3, 2014 14:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save razum2um/dc78032ef76778ac6a38 to your computer and use it in GitHub Desktop.
Save razum2um/dc78032ef76778ac6a38 to your computer and use it in GitHub Desktop.
user=> (defn map-by-results-of-f [f & xs] (into {} (map (fn [x] [(apply f x) x]) xs)))
#'user/map-by-results-of-f
user=> (map-by-results-of-f + [1 2 3] [1 2 2 2] [2 4 1 1])
{6 [1 2 3], 7 [1 2 2 2], 8 [2 4 1 1]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment