diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2012-09-01 02:17:18 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2012-09-01 02:17:18 -0700 |
commit | 607e330c05d28f1c11d816c1a656b9adad908f50 (patch) | |
tree | 3f616fc1566753d2437465e8cd6abbf5c30f5822 /txr.1 | |
parent | af11cf8971267c7e44c400477383d5fa8acf9771 (diff) | |
download | txr-607e330c05d28f1c11d816c1a656b9adad908f50.tar.gz txr-607e330c05d28f1c11d816c1a656b9adad908f50.tar.bz2 txr-607e330c05d28f1c11d816c1a656b9adad908f50.zip |
* txr.1: Documented print, pprint, tostring and tostringp.
Diffstat (limited to 'txr.1')
-rw-r--r-- | txr.1 | 36 |
1 files changed, 36 insertions, 0 deletions
@@ -7900,6 +7900,42 @@ truncated off entirely, including the decimal point. .SS Functions print, pprint, tostring, tostringp +.TP +Syntax: + + (print <obj> [<stream>]) + (pprint <obj> [<stream>]) + (tostring <obj>) + (tostringp <obj>) + +.TP +Description: + +The print and pprint functions render a printed character representation of the +obj argument into a stream. If a stream argument is not supplied, then +the destination is the stream currently stored in the *standard-output* +variable. The print function renders in a way which strives for read-print +consistency: an object is printed in a notation which is recognized as +a similar object of the same kind when it appears in TXR source code. +The pprint function ("pretty print") does not strive for read-print consistency. +For instance it prints a string object simply by dumping its characters, rather +than by adding the surrounding quotes and rendering escape syntax for +special characters. + +The tostring and tostringp functions are like print and pprint, but +they do not accept a stream argument, instead printing to a freshly +instantiated string stream, and returning the resulting string. + +The following equivalences hold between calls to the format function +and calls to these functions: + + (format stream "~s" obj) <--> (print obj stream) + (format t "~s" obj) <--> (print obj) + (format nil "~s" obj) <--> (tostring obj) + +For pprint and tostringp, the equivalence is produced by using "~a" +in format rather than "~s". + .SS Function make-string-input-stream .SS Function make-string-byte-input-stream |