15 Conversion to Picts
library defines a protocol for
values to convert themselves to picts
. The protocol
is used by DrRacket’s interactions window, for example, to render
values that it prints. Anything that is pict-convertible?
can be used wherever a pict
can be used. These values will
be automatically converted to a pict when needed.
A property whose value should be a procedure matching the
contract (-> any/c pict?)
procedure is called when a structure with the property is passed to
; the argument to the procedure is the
structure, and the procedure’s result should be a pict.
A property whose value should be a predicate procedure
(i.e., matching the contract predicate/c
If this property is not set, then it is assumed to be
the function (λ (x) #t).
If this property is set, then this procedure is called
by pict-convertible? to determine if this particular
value is convertible (thereby supporting situations
where some instances of a given struct are convertible
to picts, but others are not).
supports the conversion protocol
(by being a struct with the prop:pict-convertible
otherwise. This function returns true
Requests a data conversion from v to a pict.