5.10 Object Printing
To customize the way that a class instance is printed by print, write and display, implement the printable<%> interface.
value
The printable<%> interface includes only the
custom-print, custom-write, and
custom-display methods. The custom-print method
accepts two arguments: the destination port and the current
quasiquote depth as an exact nonnegative integer. The
custom-write and custom-display methods each accepts
a single argument, which is the destination port to write or
display the object.
Calls to the custom-print, custom-write, or custom-display methods are like calls to a procedure attached to a structure type through the prop:custom-write property. In particular, recursive printing can trigger an escape from the call.
See prop:custom-write for more information. The printable<%> interface is implemented with interface* and prop:custom-write.
value
Like printable<%>, but includes only the
custom-write and custom-display methods.
A print request is directed to custom-write.