标签: clojure clojurescript
什么是从哈希映射中仅保留某些键的快速方法?
(def m {:a 1 :b 2 :c 3 :d 4})
显式版本:
((fn [{:keys [b c]}] {:b b :c c}) m) ;= {:b 2, :c 3}
答案 0 :(得分:7)
select-keys:
select-keys
(select-keys m [:b :c])