Skip to content

Instantly share code, notes, and snippets.

@Licenser
Created December 4, 2011 10:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Licenser/1429882 to your computer and use it in GitHub Desktop.
Save Licenser/1429882 to your computer and use it in GitHub Desktop.
(defn map-keys [f m & [ks]]
(loop [new-map (transient {}) ks ks]
(if (empty? ks)
(persistent! new-map)
(let [[k & ks] ks]
(recur (assoc! new-map k (f (m k))) ks)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment