这是一个名为 args 的假设 hashmap:
{:body {:milestones [{:status 1 :otherValues x}
{:status 2 :otherValues z}
{:status 1 :otherValues y]}}
我的目标是收集每个 :status 键的值。它们都处于相同的深度,是 :milestones 的子级。
我越来越近了。我知道如何通过这样做来检索第一个状态的值:
(let [{[{:keys [status]} x] :milestones} :body} args]
(println status))
最远的目标是找出哪些地图包含一个值为 1 的 :status 并为每个单独的地图创建一个新集合。
其实际应用是连接到 TeamworkPM 并使用 Google 日历同步具有“迟到”或“未完成”状态的里程碑。
在这种情况下,所需的输出将是 {1, 2, 1}。最终目标是拥有
{{:status 1 :otherValues x}
{:status 1 :otherValues Y}}