I have a function that removes a key from a map:
(defn remove-key [key map]
(into {}
(remove (fn [[k v]] (#{key} k))
map)))
(remove-key :foo {:foo 1 :bar 2 :baz 3})
How do i apply this function using multiple keys?
(remove-keys [:foo :bar] {:foo 1 :bar 2 :baz 3})
I have an implementation using loop...recur. Is there a more idiomatic way of doing this in Clojure?
(defn remove-keys [keys map]
(loop [keys keys
map map]
(if (empty? keys)
map
(recur (rest keys) (remove-key (first keys) map)))))