Next: Object-To-String, Previous: Printing Scheme, Up: Printing Scheme [Contents][Index]
generic-write
is a procedure that transforms a Scheme data value
(or Scheme program expression) into its textual representation and
prints it. The interface to the procedure is sufficiently general to
easily implement other useful formatting procedures such as pretty
printing, output to a string and truncated output.
Scheme data value to transform.
Boolean, controls whether characters and strings are quoted.
Extended boolean, selects format:
single line format
pretty-print (value = max nb of chars per line)
Procedure of 1 argument of string type, called repeatedly with
successive substrings of the textual representation. This procedure can
return #f
to stop the transformation.
The value returned by generic-write
is undefined.
Examples:
(write obj) ≡ (generic-write obj #f #f display-string) (display obj) ≡ (generic-write obj #t #f display-string)
where
display-string ≡ (lambda (s) (for-each write-char (string->list s)) #t)