Maybe you could use a parent map. You have a normal tree, and then you have a map where you can get the parent for a given node. I don't know if this will be too slow for your problem - it's just an idea.
Kind regards Sune On Oct 13, 6:45 pm, andrei <andrei.zhabin...@gmail.com> wrote: > How can I override print-method for a map, defined with defstruct? > > I have to create object hierarchy: one map is a parent for another, > i.e. it holds link to a child, and another is a child for the first > one, i.e. holds link to a parent. When I try to print it, I get > StackOverflowError since printer tries recursively print objects: > > parent -> child -> parent -> child -> .... > > The best solution I see is to override print-method or str, so the > printing will go normally. I found this topic: > > http://groups.google.com/group/clojure/browse_thread/thread/4a675222f... > > which shows how to override print-method for objects defined by > deftype, but is there a way to do same trick for maps? Maybe it is > possible to add some special tag to object's meta? Or to redefine > print-method in the only namespace? > > Or maybe I'm just looking at the wrong direction? -- 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