On Mar 16, 11:20 am, Mark Engelberg <mark.engelb...@gmail.com> wrote: > On Tue, Mar 15, 2011 at 11:12 PM, Shantanu Kumar > <kumar.shant...@gmail.com>wrote: > > > Use the node's metadata to annotate :visited as true and re-associate, > > and do it recursively (likely with loop recur)? > > > Regards, > > Shantanu > > Altering metadata is generally a non-destructive operation (with-meta), and > alter-meta! only works on refs/agents/etc. So I don't see how you could use > metadata in this manner. You'd effectively be creating new nodes as you > traverse the tree, and then the "pointers" between the nodes would get > totally screwed up. Can you elaborate on your idea?
The idea goes like this: You re-associate the node to the collection after you modify the metadata of each node using (with-meta). The important part is every node after visit must be re-associated to the same collection it was originally part of, drilling-down recursively. This may potentially interfere with order/position of the node-in- collection but that is another problem. I was not thinking about "pointers" because I presumed persistent data structures. Regards, Shantanu -- 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