Thanks a lot, guys :) On Friday, August 2, 2013 5:07:37 AM UTC+2, Armando Blancas wrote: > > Adding to that... have a look at the implemented methods in > core_print.clj. The print-method will get called on print and println with > your instance as the first argument. In this example prints a pair type; > since elements can be anything it just calls print on each. > > (deftype Pair [fst snd]) > (defmethod print-method Pair [r, ^java.io.Writer w] > (.write w "Pair(") > (print (.fst r)) > (.write w ",") > (print (.snd r)) > (.write w ")")) > > On Thursday, August 1, 2013 3:04:47 PM UTC-7, Laurent PETIT wrote: >> >> I think you have to provide methods for multimethods print-dup and >> print-method: >> >> >> https://github.com/clojure/clojure/blob/c6756a8bab137128c8119add29a25b0a88509900/src/clj/clojure/core.clj#L3311 >> >> >> 2013/8/1 Dragan Djuric <drag...@gmail.com>: >> > I have some custom types defined using deftype and I am trying to >> enable a >> > human-friendly string representation of these types in repl. Something >> > similar to #<Atom@123 "value">. How to do that in Clojure without >> redefining >> > toString? It seems that Clojure use a different way to achieve this for >> > atoms and refs, I just can't find what. >> > >> > -- >> > -- >> > You received this message because you are subscribed to the Google >> > Groups "Clojure" group. >> > To post to this group, send email to clo...@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+u...@googlegroups.com >> > For more options, visit this group at >> > http://groups.google.com/group/clojure?hl=en >> > --- >> > You received this message because you are subscribed to the Google >> Groups >> > "Clojure" group. >> > To unsubscribe from this group and stop receiving emails from it, send >> an >> > email to clojure+u...@googlegroups.com. >> > For more options, visit https://groups.google.com/groups/opt_out. >> > >> > >> >
-- -- 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 --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.