Buy GNU books!
|[ < ]||[ > ]||[ << ]||[ Up ]||[ >> ]||[Top]||[Contents]||[Index]||[ ? ]|
(ice-9 pretty-print) provides the procedure
pretty-print, which provides nicely formatted output of Scheme
objects. This is especially useful for deeply nested or complex data
structures, such as lists and vectors.
The module is loaded by simply saying.
(use-modules (ice-9 pretty-print))
This makes the procedure
pretty-print available. As an example
pretty-print will format the output, see the following:
(pretty-print '(define (foo) (lambda (x) (cond ((zero? x) #t) ((negative? x) -x) (else (if (= x 1) 2 (* x x x))))))) -| (define (foo) (lambda (x) (cond ((zero? x) #t) ((negative? x) -x) (else (if (= x 1) 2 (* x x x))))))
pretty-print uses it's own write procedure, it's
output will not be the same as for example the output of
Consider the following example.
(write (lambda (x) x)) -| #<procedure #f (x)> (pretty-print (lambda (x) x)) -| #[procedure]
The reason is that
pretty-print does not know as much about
Guile's object types as the builtin procedures. This is particularly
important for smobs, for which a write procedure can be defined and be
write, but not by
|webmaster||delorie software privacy|
|Copyright © 2003 by The Free Software Foundation||Updated Jun 2003|