clojure - 使幽灵返回(部分)所选路径
问题描述
在以下结构中,我知道如何遍历:x
的所有子项的值:whatever
:
=> (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]]
推荐阅读
- c# - Path.GetDirectoryName 产生 Win32Exception '访问被拒绝'
- node.js - 在 Node 中为 markdown 添加前面的内容
- css - 如何操作一个Angular 8 中的样式
- configuration - Rust:如何在运行时读取配置文件并存储在全局结构中,可跨线程访问?
- c - 一旦在循环外调用我的 createNewNode 函数,它就不起作用。可能是什么问题呢?
- mysql - MariaDB 逻辑更改具有非常大的 IN (...) 集
- python - Python 多处理 - mp.Pool.join 需要越来越长的时间
- r - 在r中的for循环中通过if函数设置某些行的值
- java - 基于实现 Comparator 的类进行排序的集合排序
- python - 为什么我收到明显存在的文件的导入错误