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/4a675222f208899d

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

Reply via email to