Recreate a flattened tree
问题 I have a vector of maps, that I'd like to transform in a nested fashion. The data is structured as follows: (def data [{:id 1 :name "a" :parent 0} {:id 2 :name "b" :parent 0} {:id 3 :name "c" :parent 0} {:id 4 :name "a_1" :parent 1} {:id 5 :name "a_2" :parent 1} {:id 6 :name "b_1" :parent 2} {:id 7 :name "a_1_1" :parent 4}]) Each map has an :id , some other keys and values not important for this discussion, and :parent key, denoting if the elements belong to another element. If :parent is 0,