File: write.html

package info (click to toggle)
gcl 2.6.14-21
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 60,864 kB
  • sloc: ansic: 177,407; lisp: 151,509; asm: 128,169; sh: 22,510; cpp: 11,923; tcl: 3,181; perl: 2,930; makefile: 2,360; sed: 334; yacc: 226; lex: 95; awk: 30; fortran: 24; csh: 23
file content (207 lines) | stat: -rw-r--r-- 8,791 bytes parent folder | download | duplicates (4)
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Created by GNU Texinfo 6.7, http://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>write (ANSI and GNU Common Lisp Document)</title>

<meta name="description" content="write (ANSI and GNU Common Lisp Document)">
<meta name="keywords" content="write (ANSI and GNU Common Lisp Document)">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<link href="index.html" rel="start" title="Top">
<link href="Printer-Dictionary.html" rel="up" title="Printer Dictionary">
<link href="write_002dto_002dstring.html" rel="next" title="write-to-string">
<link href="set_002dpprint_002ddispatch.html" rel="prev" title="set-pprint-dispatch">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>


</head>

<body lang="en">
<span id="write"></span><div class="header">
<p>
Next: <a href="write_002dto_002dstring.html" accesskey="n" rel="next">write-to-string</a>, Previous: <a href="set_002dpprint_002ddispatch.html" accesskey="p" rel="prev">set-pprint-dispatch</a>, Up: <a href="Printer-Dictionary.html" accesskey="u" rel="up">Printer Dictionary</a> &nbsp; </p>
</div>
<hr>
<span id="write_002c-prin1_002c-print_002c-pprint_002c-princ-_005bFunction_005d"></span><h4 class="subsection">22.4.14 write, prin1, print, pprint, princ                               [Function]</h4>

<p><code>write</code>  <i><i>object</i> <span class="roman">&amp;key</span> \writekeys<span class="roman">stream</span></i><br>
   &rArr;  <i>object</i>
</p>
<p><code>prin</code>  <i>1</i> &rArr;  <i>object <span class="roman">&amp;optional</span> output-stream</i>
 <span class="roman">object</span>
<code>princ</code>  <i>object <span class="roman">&amp;optional</span> output-stream</i> &rArr;  <i>object</i>
</p>
<p><code>print</code>  <i>object <span class="roman">&amp;optional</span> output-stream</i> &rArr;  <i>object</i>
</p>
<p><code>pprint</code>  <i>object <span class="roman">&amp;optional</span> output-stream</i> &rArr;  <i>&lt;<i>no <i>values</i></i>&gt;</i>
</p>
<span id="Arguments-and-Values_003a_003a-467"></span><h4 class="subsubheading">Arguments and Values::</h4>

<p><i>object</i>&mdash;an <i>object</i>.
</p>
<p><i>output-stream</i>&mdash;an <i>output</i> <i>stream designator</i>.
		        The default is <i>standard output</i>.
</p>
<p>\writekeydescriptions<span class="roman"><i>stream</i>&mdash;an <i>output</i> <i>stream designator</i>.
The default is <i>standard output</i>.</span>
</p>
<span id="Description_003a_003a-602"></span><h4 class="subsubheading">Description::</h4>

<p><b>write</b>, <b>prin1</b>, <b>princ</b>, <b>print</b>, and <b>pprint</b>
write the printed representation of <i>object</i> to <i>output-stream</i>.
</p>
<p><b>write</b> is the general entry point to the <i>Lisp printer</i>.
For each explicitly supplied <i>keyword parameter</i> named in Figure 22&ndash;6,
the corresponding <i>printer control variable</i> is dynamically bound to its <i>value</i>
while printing goes on;
for each <i>keyword parameter</i> in Figure 22&ndash;6 that is not explicitly supplied,
the value of the corresponding <i>printer control variable</i> is the same as it was
at the time <b>write</b> was invoked.
Once the appropriate <i>bindings</i> are <i>established</i>,
the <i>object</i> is output by the <i>Lisp printer</i>.
</p>
<div class="format">
<pre class="format">  Parameter        Corresponding Dynamic Variable  <!-- /@w -->
  <i>array</i>            <b>*print-array*</b>                   <!-- /@w -->
  <i>base</i>             <b>*print-base*</b>                    <!-- /@w -->
  <i>case</i>             <b>*print-case*</b>                    <!-- /@w -->
  <i>circle</i>           <b>*print-circle*</b>                  <!-- /@w -->
  <i>escape</i>           <b>*print-escape*</b>                  <!-- /@w -->
  <i>gensym</i>           <b>*print-gensym*</b>                  <!-- /@w -->
  <i>length</i>           <b>*print-length*</b>                  <!-- /@w -->
  <i>level</i>            <b>*print-level*</b>                   <!-- /@w -->
  <i>lines</i>            <b>*print-lines*</b>                   <!-- /@w -->
  <i>miser-width</i>      <b>*print-miser-width*</b>             <!-- /@w -->
  <i>pprint-dispatch</i>  <b>*print-pprint-dispatch*</b>         <!-- /@w -->
  <i>pretty</i>           <b>*print-pretty*</b>                  <!-- /@w -->
  <i>radix</i>            <b>*print-radix*</b>                   <!-- /@w -->
  <i>readably</i>         <b>*print-readably*</b>                <!-- /@w -->
  <i>right-margin</i>     <b>*print-right-margin*</b>            <!-- /@w -->

  Figure 22&ndash;6: Argument correspondences for the WRITE function.<!-- /@w -->

</pre></div>

<p><b>prin1</b>, <b>princ</b>, <b>print</b>, and <b>pprint</b> implicitly 
<i>bind</i> certain print parameters to particular values.  The remaining parameter
values are taken from 
     <b>*print-array*</b>,
     <b>*print-base*</b>,
     <b>*print-case*</b>, 
     <b>*print-circle*</b>,
     <b>*print-escape*</b>,
     <b>*print-gensym*</b>,
     <b>*print-length*</b>,
     <b>*print-level*</b>,
     <b>*print-lines*</b>,
     <b>*print-miser-width*</b>,
     <b>*print-pprint-dispatch*</b>,
     <b>*print-pretty*</b>, 
     <b>*print-radix*</b>, 
 and <b>*print-right-margin*</b>.
</p>
<p><b>prin1</b> produces output suitable for input to <b>read</b>.  
It binds <b>*print-escape*</b> to <i>true</i>.
</p>
<p><b>princ</b> is just like <b>prin1</b> except that the
output has no <i>escape</i> <i>characters</i>.
It binds <b>*print-escape*</b>   to <i>false</i>
</p>
<p>and <b>*print-readably*</b> to <i>false</i>.
</p>
<p>The general rule is that output from <b>princ</b> is intended to look
good to people, while output from <b>prin1</b> is intended to
be acceptable to <b>read</b>.
</p>
<p><b>print</b> is just like <b>prin1</b> 
except that the printed representation
of <i>object</i> is preceded by a newline 
and followed by a space.
</p>
<p><b>pprint</b> is just like <b>print</b> except that the trailing
space is omitted and 
<i>object</i> is printed with the <b>*print-pretty*</b> flag <i>non-nil</i> 
to produce pretty output.
</p>
<p><i>Output-stream</i> specifies the <i>stream</i> to which 
output is to be sent.  
</p>
<span id="Affected-By_003a_003a-102"></span><h4 class="subsubheading">Affected By::</h4>

<p><b>*standard-output*</b>,
<b>*terminal-io*</b>,
<b>*print-escape*</b>,
<b>*print-radix*</b>,
<b>*print-base*</b>,
<b>*print-circle*</b>,
<b>*print-pretty*</b>,
<b>*print-level*</b>,
<b>*print-length*</b>,
<b>*print-case*</b>,
<b>*print-gensym*</b>,
<b>*print-array*</b>,
<b>*read-default-float-format*</b>.
</p>
<span id="See-Also_003a_003a-488"></span><h4 class="subsubheading">See Also::</h4>

<p><a href="readtable_002dcase.html">readtable-case</a>
,
<a href="FORMAT-Printer-Operations.html">FORMAT Printer Operations</a>
</p>
<span id="Notes_003a_003a-303"></span><h4 class="subsubheading">Notes::</h4>

<p>The <i>functions</i> <b>prin1</b> and <b>print</b> do not bind <b>*print-readably*</b>.
</p>
<div class="example">
<pre class="example"> (prin1 object output-stream)
&equiv; (write object :stream output-stream :escape t)
</pre></div>

<div class="example">
<pre class="example"> (princ object output-stream)
&equiv; (write object stream output-stream :escape nil :readably nil)
</pre></div>

<div class="example">
<pre class="example"> (print object output-stream)
&equiv; (progn (terpri output-stream)
           (write object :stream output-stream
                         :escape t)
           (write-char #\space output-stream))
</pre></div>

<div class="example">
<pre class="example"> (pprint object output-stream)
&equiv; (write object :stream output-stream :escape t :pretty t)
</pre></div>

<hr>
<div class="header">
<p>
Next: <a href="write_002dto_002dstring.html" accesskey="n" rel="next">write-to-string</a>, Previous: <a href="set_002dpprint_002ddispatch.html" accesskey="p" rel="prev">set-pprint-dispatch</a>, Up: <a href="Printer-Dictionary.html" accesskey="u" rel="up">Printer Dictionary</a> &nbsp; </p>
</div>



</body>
</html>