31 Struct Printing
This library is unstable;
compatibility will not be maintained.
See Unstable: May Change Without Warning for more information.
(require unstable/custom-write) |
procedure
(make-constructor-style-printer get-constructor get-contents) → (-> any/c output-port? (or/c #t #f 0 1) void?) get-constructor : (-> any/c (or/c symbol? string?)) get-contents : (-> any/c sequence?)
Produces a function suitable as a value for prop:custom-write. The
function prints values in “constructor style.” When the value is
printed as an expression, it is shown as an application of the
constructor (as returned by get-constructor) to the contents (as
returned by get-contents). When given to write, it is shown as
an unreadable value with the constructor separated from the contents by a colon.
Examples: | ||||||||||||||||
|
The function also cooperates with pretty-print:
Examples: | ||||||||||||||||||
|
value
prop:auto-custom-write : (struct-type-property/c 'constructor)
When attached to a struct type, automatically generates a printer using
make-constructor-style-printer and attaches it to the struct type’s
prop:custom-write property. It also sets the
prop:custom-print-quotable property to 'never.
Examples: | |||||||||||||
|