我希望能夠在樹狀數據結構中插入數據結構(例如在Disqus,Hacker News等上發表評論的數據結構)。並且以巧妙的功能性方式來完成這將是一件好事。Clojure中的線程評論
例
(def cmts [{:name "Abi" :id 1 :text "Great question" :children nil}
{:name "Bib" :id 2 :text "What about zippers?" :children
[{:name "Linus" :id 3
:text "I don't understand how to and insert
children at a certain id with them"
:children nil}]}])
的問題是如何將這樣
(add-comment cmts :name "Iba" :text "I think so too!" :in-reply-to 1)
在某種程度上簡潔/優雅的方式
評論。
或者:什麼是解決問題的更簡單方法?