On Thu, Jan 12, 2012 at 11:51 AM, Mark Engelberg <mark.engelb...@gmail.com> wrote: > This mechanism: > > (defrecord MyRecord [name] > Object > (toString [_] name)) > > no longer seems to control the way that records print at the repl. > [It does control what happens when you say (str (MyRecord "name")) but > not when the repl prints it]. > > What's the current way to control the way that records print at the repl?
The repl uses the `print-method` generic function that dispatches on the class. To override the behaviour you need to provide a custom implementation of that fn like this - (defmethod clojure.core/print-method user.MyRecord [x writer] (.write writer (:name x))) The caveat here is that this will also break the `readability` of the record. Also take a look at the `print-dup` multimethod. Regards, BG -- Baishampayan Ghose b.ghose at gmail.com -- 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