Reputation: 5944
What would be a quick way to keep only certain keys from a hash-map?
(def m {:a 1 :b 2 :c 3 :d 4})
explicit version:
((fn [{:keys [b c]}] {:b b :c c}) m) ;= {:b 2, :c 3}
Upvotes: 2
Views: 122
Reputation: 144136
select-keys:
select-keys
(select-keys m [:b :c])
Upvotes: 7