1 Print Convert Properties

▼ |  | Legacy Print Convert

1 | Print Convert Properties

On this page:

prop: print-converter
print-converter?
print-converter-proc
prop: print-convert-constructor-name
print-convert-named-constructor?
print-convert-constructor-name

top contents ← prev up next →

## 1 Print Convert Properties🔗ℹ

(require mzlib/pconvert-prop) | package: pconvert-lib

> value prop:print-converter : property?
> procedure (print-converter? v) → any
> v : any/c
> procedure (print-converter-proc v)
> → (any/c (any/c . -> . any/c) . -> . any/c)
> v : print-converter?

The prop:print-converter property can be given a procedure value for a structure type. In that case, for constructor-style print conversion via print-convert, instances of the structure are converted by calling the procedure that is the property’s value. The procedure is called with the value to convert and a procedure to recursively convert nested values. The result should be an S-expression for the converted value.

The print-converter? predicate recognizes instances of structure types that have the prop:print-converter property, and print-converter-proc extracts the property value.

> value prop:print-convert-constructor-name : property?
> procedure (print-convert-named-constructor? v) → any
> v : any/c
> procedure (print-convert-constructor-name v) → any
> v : print-convert-named-constructor?

The prop:print-convert-constructor-name property can be given a symbol value for a structure type. In that case, for constructor-style print conversion via print-convert, instances of the structure are shown using the symbol as the constructor name.

The prop:print-converter property takes precedence over prop:print-convert-constructor-name. If neither is attached to a structure type, its instances are converted using a constructor name that is make- prefixed onto the result of object-name.

The print-convert-named-constructor? predicate recognizes instances of structure types that have the prop:print-convert-constructor-name property, and print-convert-constructor-name extracts the property value.

top contents ← prev up next →