使幽灵return(部分)选定路径
Make specter return (part of) the selected path
在下面的结构中,我知道如何迭代 :whatever
的所有 children 的 :x
值:
=> (specter/select
[:whatever specter/MAP-VALS :x]
{:whatever {:a {:x 1} :b {:x 2}}})
[1 2]
我想得到的是类似下面的内容,其中包含 wild-carded 映射键。
[[: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]]
在下面的结构中,我知道如何迭代 :whatever
的所有 children 的 :x
值:
=> (specter/select
[:whatever specter/MAP-VALS :x]
{:whatever {:a {:x 1} :b {:x 2}}})
[1 2]
我想得到的是类似下面的内容,其中包含 wild-carded 映射键。
[[: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]]