在以下结构中,我知道如何迭代:x
的所有子项的:whatever
值:
=> (specter/select
[:whatever specter/MAP-VALS :x]
{:whatever {:a {:x 1} :b {:x 2}}})
[1 2]
我想要得到的是类似于以下内容,其中包含通配符map密钥。
[[:a 1] [:b 2]]
如何用幽灵来做到这一点?
答案 0 :(得分: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]]