我有一个看起来像这样的数据结构:
(def conf
{ :devices [{:alias "OSC Sender",
:name "OSC Sender",
:ins [{:name "xpos", :type :int, :mutable true}]},
{:alias "const2", :name "const",
:outs [{:name "out", :type :int}]}],
:connections {"const2.out" "OSC Sender.xpos"},
:layout [{:alias "const2",
:x 72.12447405329594,
:y 99.88499298737729},
{:alias "tick",
:x 82.5732819074334,
:y 133.91374474053296},
{:alias "OSC Sender",
:x 185.17741935483872,
:y 113.90322580645162}]})
我想通过键(特别是)加入地图以:devices
丰富设备的布局信息。:layout
:alias
现在我拼凑了以下解决方案:
(map (partial reduce merge) (vals (group-by :alias (concat (:devices conf) (:layout conf)))))
这是惯用的连接还是其他更可取的方法?
干杯