Skip to content

Instantly share code, notes, and snippets.

@charles-dyfis-net
Created December 8, 2012 00:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save charles-dyfis-net/2235a2fa03ecd57b0a7c to your computer and use it in GitHub Desktop.
Save charles-dyfis-net/2235a2fa03ecd57b0a7c to your computer and use it in GitHub Desktop.
(defn walk-soda-obj [obj]
"For each object in the given parse tree, yield:
[key object parent & [list list-idx]]"
(let [obj-bean (soda-bean obj)]
(concat
(for [[prop-key child-list] (.getMutableLists obj-bean)
[child-idx child] (map-indexed vector child-list)]
(concat
[[prop-key child obj child-list child-idx]]
(walk-soda-obj child)))
(for [[prop-key child] (.getItemMap obj-bean)
:when child]
(concat
[[prop-key child obj]]
(walk-soda-obj child))))))
@charles-dyfis-net
Copy link
Author

Intended output is a single sequence of vectors. Actual output is a sequence of sequences of vectors

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment