If I have a map of fully qualified keys, i.e, {:foo/bar "baz" :foo/wibble "wobble"}
, is there a better way to return a new map with the namespace removed, i.e., :foo/
, leaving just :bar
? So, the result would be {:bar "baz" :wibble "wobble"}
. My initial attempt is this (map #(s/rename-keys % {:foo/bar :bar :foo/wibble :wobble}))
and use that in a transducer.
The downside of my approach is that I need to know every key name, whereas I just want to throw a map to something, with a prefix and say, remove all :foo/
thank you very much sir!
(p.s., s/rename-keys
comes from clojure.set
)
(into {} (map (fn [[k v]] [(keyword (name k)) v])) m)
is a more general way to do it
oooh
very handy, thank you!