Clojure 使specter返回(部分)所选路径
在下面的结构中,我知道如何迭代Clojure 使specter返回(部分)所选路径,clojure,specter,Clojure,Specter,在下面的结构中,我知道如何迭代:x的所有子级的:which: => (specter/select [:whatever specter/MAP-VALS :x] {:whatever {:a {:x 1} :b {:x 2}}}) [1 2] 我想得到的是下面这样的东西,其中包含通配符映射键 [[:a 1] [:b 2]] 用幽灵怎么能做到这一点 (select [:whatever ALL (collect-one FIRST) LAST
:x
的所有子级的:which
:
=> (specter/select
[:whatever specter/MAP-VALS :x]
{:whatever {:a {:x 1} :b {:x 2}}})
[1 2]
我想得到的是下面这样的东西,其中包含通配符映射键
[[:a 1] [:b 2]]
用幽灵怎么能做到这一点
(select
[:whatever ALL (collect-one FIRST) LAST :x]
{:whatever {:a {:x 1}
:b {:x 2}
:c {:x 55}}})
=> [[:a 1] [:b 2] [:c 55]]