[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Custom Printers
You may use set-record-type-printer!
to customize the default printing
behavior of records. This is a Guile extension and is not part of SRFI-9. It
is located in the (srfi srfi-9 gnu)
module.
- Scheme Syntax: set-record-type-printer! name thunk
Where type corresponds to the first argument of
define-record-type
, and thunk is a procedure accepting two arguments, the record to print, and an output port.
This example prints the employee’s name in brackets, for instance [Fred]
.
(set-record-type-printer! employee-type (lambda (record port) (write-char #\[ port) (display (get-employee-name record) port) (write-char #\] port)))
This document was generated on February 3, 2012 using texi2html 5.0.