如何在嵌套列表/向量clojure中提取数据
我已经解析了xml并得到了以下结果如何在嵌套列表/向量clojure中提取数据,clojure,Clojure,我已经解析了xml并得到了以下结果 (({:tag :Column, :attrs {:Name "VENDOR_KEY", :Type "Int", :NotNull "Yes"}, :content nil} {:tag :Column, :attrs {:Name "RETAILER_KEY", :Type "Int", :NotNull "Yes"}, :content nil} {:tag :Column, :attrs {:Name "ITEM_
(({:tag :Column,
:attrs {:Name "VENDOR_KEY", :Type "Int", :NotNull "Yes"},
:content nil}
{:tag :Column,
:attrs {:Name "RETAILER_KEY", :Type "Int", :NotNull "Yes"},
:content nil}
{:tag :Column,
:attrs {:Name "ITEM_KEY", :Type "Int", :NotNull "Yes"},
:content nil})
({:tag :Column,
:attrs {:Name "Store_Key", :Type "Int", :NotNull "Yes"},
:content nil}))
然后如何将其转换为以下内容,基本上我想在嵌套列表中提取key:attrs的值
(
({:Name "VENDOR_KEY", :Type "Int", :NotNull "Yes"},
{:Name "RETAILER_KEY", :Type "Int", :NotNull "Yes"},
{:Name "ITEM_KEY", :Type "Int", :NotNull "Yes"}),
({:Name "Store_Key", :Type "Int", :NotNull "Yes"})
)
所以,是的,在这里,你的解决方案是 说
我假设结果是您的输入数据。(map:attrs(first result))@hsestupin,您的解决方案仅从列表中的第一个列表中获取数据,示例中有两个列表。我可以将您的列表与(map:attr(second result))组合,但如果列表中有10个列表呢?@DanielWu
(map#(map:attrs%)result)
应该可以
(map #(map :attrs %) result)