Skip to content

Instantly share code, notes, and snippets.

@verma
Created April 4, 2014 19:15
Show Gist options
  • Save verma/9981313 to your computer and use it in GitHub Desktop.
Save verma/9981313 to your computer and use it in GitHub Desktop.
(defn map-vals
"Maps the values of the map col using f"
[f col]
(into {} (map (fn [[a b]] [a (f b)]) col)))
@verma
Copy link
Author

verma commented Apr 4, 2014

With for:

(defn map-vals
  "Maps the values of the given given map using the given function"
  [f col]
  (into {} (for [[k v] col] [k (f v)])))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment