I stumbled across the clojure.zip library today which looks extremely 
useful for working with trees. The only problem is I can't figure out how 
to represent a tree as a vector so that the zipper will have the correct 
structure. For example say I want to work with this tree:

<https://lh5.googleusercontent.com/-mq1roiqfqw4/UHxvMDQUIfI/AAAAAAAAA_o/mNA9pAkOEIs/s1600/tree.png>
my first intuition was a vector like this [:A [:B [:D :E]] [:C [:F :G]]] but 
that didn't work. Then I thought of something like this: [[:B [:D :E]] :A 
[:C [:F :G]]]. It seems like that gets me a little bit closer since now the 
zipper at least gets that :A has two children.

Can anyone help me understand how to represent a tree in a Clojure vector? 
Is there a common lispy way of doing this that everyone already knows? It 
seems like all of the references I could find online all assume that you 
know how to represent a tree already.

Thanks,

Dave

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to