clojure.core/print-method is a multi method that handles the printing of
objects. You can override or implement the print method by:

(defmethod print-method my.class.Foo
  [^my.class.Foo instance ^Writer w]
  (.write w ....<string>...))

I do that to provide custom printing for deftypes, but you can easily
override how records are printed as well.

Timothy

On Sat, Nov 12, 2016 at 2:35 AM, Colin Yates <colin.ya...@gmail.com> wrote:

> Hi all,
>
> I cache quite a bit of stuff on the server, so when I return or print
> out the 'system' I get the unhelpful recursive stack trace of Java
> running out of heap.
>
> Is there some protocol I can implement on large data structures such
> that whenever they are serialised they just dump some of their
> contents?
>
> These objects will only ever be printed out either at the REPL,
> (println) or clojure.tools.logging/log etc. I never expect them to be
> serialised and then later deserialised from the serialised form.
>
> Any suggestions?
>
> Thanks all,
>
> Colin
>
> --
> 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/d/optout.
>



-- 
“One of the main causes of the fall of the Roman Empire was that–lacking
zero–they had no way to indicate successful termination of their C
programs.”
(Robert Firth)

-- 
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/d/optout.

Reply via email to