code-reviews

dominicm 2018-11-25T20:07:00.081300Z

This shows a pattern I frequently encounter, and I'm unhappy with:

(defn post-order-tree-seq
 [branch? children root]
 (let [walk (fn walk [n]
              (if (branch? n)
                (concat (mapcat walk (children n)) [n])
                [n]))]
   (walk root)))
Using concat like this to control ordering seems unusual. Is it? Is there something better I could be doing here (relating to this, or the code generally - e.g. lazy-seq)