summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--txr.136
2 files changed, 40 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 4a2cc35e..0104fe12 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2012-09-01 Kaz Kylheku <kaz@kylheku.com>
+
+ * txr.1: Documented print, pprint, tostring and tostringp.
+
2012-08-31 Kaz Kylheku <kaz@kylheku.com>
* stream.c (vformat): Bugfix: under the ~a and ~s directives,
diff --git a/txr.1 b/txr.1
index e41c1f3c..138e43ac 100644
--- a/txr.1
+++ b/txr.1
@@ -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