我需要收集:c/name
值到嵌套向量中,并以相同的方式转换到第一级。
输入示例:
[:a/name "name" :a/vals [{:b/val [{:c/name "one"}{:c/name "two"}]}
{:b/val [{:c/name "three"}]}]]
输出:
[:a/name :a/vals "one, two, three"]
答案 0 :(得分:0)
这会产生输入的输出,这是你想要的吗?
(defn f [[k1 _ k2 rels]]
[k1 k2
(clojure.string/join ", "
(map :c/name (apply concat (mapcat vals rels))))])