chickadee » describe » set-describer!

set-describer! TAG PROCprocedure

Sets a custom description handler that invokes PROC when the ,d or describe command is invoked with a record-type object that has the type TAG (a symbol). PROC is called with two arguments: the object to be described and an output-port. It should write a possibly useful textual description of the object to the passed output-port. For example:

#;1> (define-record-type point (make-point x y) point?
       (x point-x)
       (y point-y))
#;2> (set-describer! 'point 
       (lambda (pt o)
         (with-output-to-port o
           (lambda ()
             (print "a point with x=" (point-x pt) " and y=" (point-y pt))))))
#;3> ,d (make-point 1 2)
a point with x=1 and y=2