请考虑以下事项:
list of hashmaps '({:key 1 :other-key "hello"} {:key 2 :other-key "bye"})
some list of keys: '(1)
;; I want the result to be:
[{:key 1 :other-key "hello"}]
有一种简单的方法来过滤掉它吗?
答案 0 :(得分:2)
你可以这样做:
(def l1 '({:key 1, :other-key "hello"} {:key 2, :other-key "bye"}))
(def l2 '(1))
(filter #(contains? (set l2) (:key %)) l1)
答案 1 :(得分:1)
结束了这样的事情:
static final