Next: , Previous: , Up: iklib records defs   [Index]


6.19.1.5 The custom printer

In a use of the syntax define-record-type, the definition clause:

(custom-printer ?expr)

allows the specification of an expression ?expr which must evaluate to a custom printer function for instances of the record–type; iklib records printer, for details on record’s custom printers.

Usage example:

(define-record-type duo
  (fields one two)
  (custom-printer
    (lambda (record port sub-printer)
      (display "#{record duo one=" port)
      (display (duo-one record) port)
      (display " two=" port)
      (display (duo-two record) port)
      (display "}" port))))

(display (make-duo 1 2))
-| #{record duo one=1 two=2}