pretty-print
s obj on port. If port is not specified,current-output-port
is used.Example:
(pretty-print '((1 2 3 4 5) (6 7 8 9 10) (11 12 13 14 15) (16 17 18 19 20) (21 22 23 24 25))) -| ((1 2 3 4 5) -| (6 7 8 9 10) -| (11 12 13 14 15) -| (16 17 18 19 20) -| (21 22 23 24 25))
Returns the string of obj
pretty-print
ed in width columns. If width is not specified,(output-port-width)
is used.Example:
(pretty-print->string '((1 2 3 4 5) (6 7 8 9 10) (11 12 13 14 15) (16 17 18 19 20) (21 22 23 24 25))) ⇒ "((1 2 3 4 5) (6 7 8 9 10) (11 12 13 14 15) (16 17 18 19 20) (21 22 23 24 25)) " (pretty-print->string '((1 2 3 4 5) (6 7 8 9 10) (11 12 13 14 15) (16 17 18 19 20) (21 22 23 24 25)) 16) ⇒ "((1 2 3 4 5) (6 7 8 9 10) (11 12 13 14 15) (16 17 18 19 20) (21 22 23 24 25)) "
Pretty-prints all the code in infile. If outfile is specified, the output goes to outfile, otherwise it goes to
(current-output-port)
.
infile is a port or a string naming an existing file. Scheme source code expressions and definitions are read from the port (or file) and proc is applied to them sequentially.
outfile is a port or a string. If no outfile is specified then
current-output-port
is assumed. These expanded expressions are thenpretty-print
ed to this port.Whitepsace and comments (introduced by
;
) which are not part of scheme expressions are reproduced in the output. This procedure does not affect the values returned bycurrent-input-port
,current-error-port
, andcurrent-output-port
.
pprint-filter-file
can be used to pre-compile macro-expansion and
thus can reduce loading time. The following will write into
exp-code.scm the result of expanding all defmacros in
code.scm.
(require 'pprint-file) (require 'defmacroexpand) (defmacro:load "my-macros.scm") (pprint-filter-file "code.scm" defmacro:expand* "exp-code.scm")