NOTE: Clojure 1.11 Alpha 2 added update-keys
and update-vals
which provide similar functionality directly in clojure.core
, but with the hash map first and the function second.
Running this code:
clj -Sdeps '{:deps
{seancorfield/map-utils
{:git/url "https://gist.github.com/seancorfield/6e8dd10799e9cc7527da5510c739e52f"
:sha "cfde3c2c83379e93ab1a49752611ae663008129f"}}}'
That starts a REPL:
user=> (require '[map-utils :refer [map-vals map-keys]])
nil
user=> (map-vals inc {:a 1 :b 2})
{:b 3, :a 2}
user=>