How to filter a persistent map in Clojure?
- by Checkers
I have a persistent map which I want to filter. Something like this:
(filter #(-> % val (= 1)) {:a 1 :b 1 :c 2})
The above comes out as ([:a 1] [:b 1]) (a lazy sequence of map entries). However I want to be get {:a 1 :b 1}.
How can I filter a map so it remains a map without having to rebuild it from a sequence of map entries?