manpagez: man pages & more
info guile
Home | html | info | man
[ << ] [ < ] [ 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 proc

Where type corresponds to the first argument of define-record-type, and proc 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>
  (lambda (record port)
    (write-char #\[ port)
    (display (employee-name record) port)
    (write-char #\] port)))

This document was generated on April 20, 2013 using texi2html 5.0.

© 2000-2019
Individual documents may contain additional copyright information.