Created
October 11, 2012 20:12
-
-
Save metametaclass/3875190 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (defn flatten-preprocessed-node | |
| "convert preprocessed tree to linear sequence of items" | |
| [[node-attrs children]] | |
| (let [node-flags (:Flags node-attrs) | |
| is-after (:after node-flags) | |
| node-attrs-1 (update-in node-attrs [:Name] #(or % get-default-node-name)) | |
| ;node-name (or (:Name node-attrs) get-default-node-name) | |
| flatten-children (mapcat flatten-preprocessed-node children)] | |
| (if is-after ;move node after children in output seq and in :Sort (index-path) | |
| (vec (concat flatten-children [(update-in node-attrs-1 [:Path] conj 9999)])) | |
| (vec (concat [node-attrs-1] flatten-children))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment