/usr/share/doc/racket/reference/printing.html is in racket-doc 6.7-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"/><title>1.4 The Printer</title><link rel="stylesheet" type="text/css" href="../scribble.css" title="default"/><link rel="stylesheet" type="text/css" href="extras.css" title="default"/><link rel="stylesheet" type="text/css" href="../racket.css" title="default"/><link rel="stylesheet" type="text/css" href="../manual-style.css" title="default"/><link rel="stylesheet" type="text/css" href="../manual-racket.css" title="default"/><link rel="stylesheet" type="text/css" href="../manual-racket.css" title="default"/><link rel="stylesheet" type="text/css" href="../doc-site.css" title="default"/><script type="text/javascript" src="../scribble-common.js"></script><script type="text/javascript" src="../manual-racket.js"></script><script type="text/javascript" src="../manual-racket.js"></script><script type="text/javascript" src="../doc-site.js"></script><script type="text/javascript" src="../local-redirect/local-redirect.js"></script><script type="text/javascript" src="../local-redirect/local-user-redirect.js"></script><!--[if IE 6]><style type="text/css">.SIEHidden { overflow: hidden; }</style><![endif]--></head><body id="doc-racket-lang-org"><div class="tocset"><div class="tocview"><div class="tocviewlist tocviewlisttopspace"><div class="tocviewtitle"><table cellspacing="0" cellpadding="0"><tr><td style="width: 1em;"><a href="javascript:void(0);" title="Expand/Collapse" class="tocviewtoggle" onclick="TocviewToggle(this,"tocview_0");">►</a></td><td></td><td><a href="index.html" class="tocviewlink" data-pltdoc="x"><span style="font-weight: bold">The Racket Reference</span></a></td></tr></table></div><div class="tocviewsublisttop" style="display: none;" id="tocview_0"><table cellspacing="0" cellpadding="0"><tr><td align="right">1 </td><td><a href="model.html" class="tocviewselflink" data-pltdoc="x">Language Model</a></td></tr><tr><td align="right">2 </td><td><a href="notation.html" class="tocviewlink" data-pltdoc="x">Notation for Documentation</a></td></tr><tr><td align="right">3 </td><td><a href="syntax.html" class="tocviewlink" data-pltdoc="x">Syntactic Forms</a></td></tr><tr><td align="right">4 </td><td><a href="data.html" class="tocviewlink" data-pltdoc="x">Datatypes</a></td></tr><tr><td align="right">5 </td><td><a href="structures.html" class="tocviewlink" data-pltdoc="x">Structures</a></td></tr><tr><td align="right">6 </td><td><a href="mzlib_class.html" class="tocviewlink" data-pltdoc="x">Classes and Objects</a></td></tr><tr><td align="right">7 </td><td><a href="mzlib_unit.html" class="tocviewlink" data-pltdoc="x">Units</a></td></tr><tr><td align="right">8 </td><td><a href="contracts.html" class="tocviewlink" data-pltdoc="x">Contracts</a></td></tr><tr><td align="right">9 </td><td><a href="match.html" class="tocviewlink" data-pltdoc="x">Pattern Matching</a></td></tr><tr><td align="right">10 </td><td><a href="control.html" class="tocviewlink" data-pltdoc="x">Control Flow</a></td></tr><tr><td align="right">11 </td><td><a href="concurrency.html" class="tocviewlink" data-pltdoc="x">Concurrency and Parallelism</a></td></tr><tr><td align="right">12 </td><td><a href="Macros.html" class="tocviewlink" data-pltdoc="x">Macros</a></td></tr><tr><td align="right">13 </td><td><a href="input-and-output.html" class="tocviewlink" data-pltdoc="x">Input and Output</a></td></tr><tr><td align="right">14 </td><td><a href="security.html" class="tocviewlink" data-pltdoc="x">Reflection and Security</a></td></tr><tr><td align="right">15 </td><td><a href="os.html" class="tocviewlink" data-pltdoc="x">Operating System</a></td></tr><tr><td align="right">16 </td><td><a href="memory.html" class="tocviewlink" data-pltdoc="x">Memory Management</a></td></tr><tr><td align="right">17 </td><td><a href="unsafe.html" class="tocviewlink" data-pltdoc="x">Unsafe Operations</a></td></tr><tr><td align="right">18 </td><td><a href="running.html" class="tocviewlink" data-pltdoc="x">Running Racket</a></td></tr><tr><td align="right"></td><td><a href="doc-bibliography.html" class="tocviewlink" data-pltdoc="x">Bibliography</a></td></tr><tr><td align="right"></td><td><a href="doc-index.html" class="tocviewlink" data-pltdoc="x">Index</a></td></tr></table></div></div><div class="tocviewlist"><table cellspacing="0" cellpadding="0"><tr><td style="width: 1em;"><a href="javascript:void(0);" title="Expand/Collapse" class="tocviewtoggle" onclick="TocviewToggle(this,"tocview_1");">▼</a></td><td>1 </td><td><a href="model.html" class="tocviewlink" data-pltdoc="x">Language Model</a></td></tr></table><div class="tocviewsublist" style="display: block;" id="tocview_1"><table cellspacing="0" cellpadding="0"><tr><td align="right">1.1 </td><td><a href="eval-model.html" class="tocviewlink" data-pltdoc="x">Evaluation Model</a></td></tr><tr><td align="right">1.2 </td><td><a href="syntax-model.html" class="tocviewlink" data-pltdoc="x">Syntax Model</a></td></tr><tr><td align="right">1.3 </td><td><a href="reader.html" class="tocviewlink" data-pltdoc="x">The Reader</a></td></tr><tr><td align="right">1.4 </td><td><a href="" class="tocviewselflink" data-pltdoc="x">The Printer</a></td></tr></table></div></div><div class="tocviewlist"><table cellspacing="0" cellpadding="0"><tr><td style="width: 1em;"><a href="javascript:void(0);" title="Expand/Collapse" class="tocviewtoggle" onclick="TocviewToggle(this,"tocview_2");">►</a></td><td>1.4 </td><td><a href="" class="tocviewselflink" data-pltdoc="x">The Printer</a></td></tr></table><div class="tocviewsublistbottom" style="display: none;" id="tocview_2"><table cellspacing="0" cellpadding="0"><tr><td align="right">1.4.1 </td><td><a href="#%28part._print-symbol%29" class="tocviewlink" data-pltdoc="x">Printing Symbols</a></td></tr><tr><td align="right">1.4.2 </td><td><a href="#%28part._print-number%29" class="tocviewlink" data-pltdoc="x">Printing Numbers</a></td></tr><tr><td align="right">1.4.3 </td><td><a href="#%28part._print-extflonum%29" class="tocviewlink" data-pltdoc="x">Printing Extflonums</a></td></tr><tr><td align="right">1.4.4 </td><td><a href="#%28part._print-booleans%29" class="tocviewlink" data-pltdoc="x">Printing Booleans</a></td></tr><tr><td align="right">1.4.5 </td><td><a href="#%28part._print-pairs%29" class="tocviewlink" data-pltdoc="x">Printing Pairs and Lists</a></td></tr><tr><td align="right">1.4.6 </td><td><a href="#%28part._print-string%29" class="tocviewlink" data-pltdoc="x">Printing Strings</a></td></tr><tr><td align="right">1.4.7 </td><td><a href="#%28part._print-vectors%29" class="tocviewlink" data-pltdoc="x">Printing Vectors</a></td></tr><tr><td align="right">1.4.8 </td><td><a href="#%28part._print-structure%29" class="tocviewlink" data-pltdoc="x">Printing Structures</a></td></tr><tr><td align="right">1.4.9 </td><td><a href="#%28part._print-hashtable%29" class="tocviewlink" data-pltdoc="x">Printing Hash Tables</a></td></tr><tr><td align="right">1.4.10 </td><td><a href="#%28part._print-box%29" class="tocviewlink" data-pltdoc="x">Printing Boxes</a></td></tr><tr><td align="right">1.4.11 </td><td><a href="#%28part._print-character%29" class="tocviewlink" data-pltdoc="x">Printing Characters</a></td></tr><tr><td align="right">1.4.12 </td><td><a href="#%28part._print-keyword%29" class="tocviewlink" data-pltdoc="x">Printing Keywords</a></td></tr><tr><td align="right">1.4.13 </td><td><a href="#%28part._print-regexp%29" class="tocviewlink" data-pltdoc="x">Printing Regular Expressions</a></td></tr><tr><td align="right">1.4.14 </td><td><a href="#%28part._print-path%29" class="tocviewlink" data-pltdoc="x">Printing Paths</a></td></tr><tr><td align="right">1.4.15 </td><td><a href="#%28part._print-unreadable%29" class="tocviewlink" data-pltdoc="x">Printing Unreadable Values</a></td></tr><tr><td align="right">1.4.16 </td><td><a href="#%28part._print-compiled%29" class="tocviewlink" data-pltdoc="x">Printing Compiled Code</a></td></tr></table></div></div></div><div class="tocsub"><div class="tocsubtitle">On this page:</div><table class="tocsublist" cellspacing="0"><tr><td><span class="tocsublinknumber">1.4.1<tt> </tt></span><a href="#%28part._print-symbol%29" class="tocsubseclink" data-pltdoc="x">Printing Symbols</a></td></tr><tr><td><span class="tocsublinknumber">1.4.2<tt> </tt></span><a href="#%28part._print-number%29" class="tocsubseclink" data-pltdoc="x">Printing Numbers</a></td></tr><tr><td><span class="tocsublinknumber">1.4.3<tt> </tt></span><a href="#%28part._print-extflonum%29" class="tocsubseclink" data-pltdoc="x">Printing Extflonums</a></td></tr><tr><td><span class="tocsublinknumber">1.4.4<tt> </tt></span><a href="#%28part._print-booleans%29" class="tocsubseclink" data-pltdoc="x">Printing Booleans</a></td></tr><tr><td><span class="tocsublinknumber">1.4.5<tt> </tt></span><a href="#%28part._print-pairs%29" class="tocsubseclink" data-pltdoc="x">Printing Pairs and Lists</a></td></tr><tr><td><span class="tocsublinknumber">1.4.6<tt> </tt></span><a href="#%28part._print-string%29" class="tocsubseclink" data-pltdoc="x">Printing Strings</a></td></tr><tr><td><span class="tocsublinknumber">1.4.7<tt> </tt></span><a href="#%28part._print-vectors%29" class="tocsubseclink" data-pltdoc="x">Printing Vectors</a></td></tr><tr><td><span class="tocsublinknumber">1.4.8<tt> </tt></span><a href="#%28part._print-structure%29" class="tocsubseclink" data-pltdoc="x">Printing Structures</a></td></tr><tr><td><span class="tocsublinknumber">1.4.9<tt> </tt></span><a href="#%28part._print-hashtable%29" class="tocsubseclink" data-pltdoc="x">Printing Hash Tables</a></td></tr><tr><td><span class="tocsublinknumber">1.4.10<tt> </tt></span><a href="#%28part._print-box%29" class="tocsubseclink" data-pltdoc="x">Printing Boxes</a></td></tr><tr><td><span class="tocsublinknumber">1.4.11<tt> </tt></span><a href="#%28part._print-character%29" class="tocsubseclink" data-pltdoc="x">Printing Characters</a></td></tr><tr><td><span class="tocsublinknumber">1.4.12<tt> </tt></span><a href="#%28part._print-keyword%29" class="tocsubseclink" data-pltdoc="x">Printing Keywords</a></td></tr><tr><td><span class="tocsublinknumber">1.4.13<tt> </tt></span><a href="#%28part._print-regexp%29" class="tocsubseclink" data-pltdoc="x">Printing Regular Expressions</a></td></tr><tr><td><span class="tocsublinknumber">1.4.14<tt> </tt></span><a href="#%28part._print-path%29" class="tocsubseclink" data-pltdoc="x">Printing Paths</a></td></tr><tr><td><span class="tocsublinknumber">1.4.15<tt> </tt></span><a href="#%28part._print-unreadable%29" class="tocsubseclink" data-pltdoc="x">Printing Unreadable Values</a></td></tr><tr><td><span class="tocsublinknumber">1.4.16<tt> </tt></span><a href="#%28part._print-compiled%29" class="tocsubseclink" data-pltdoc="x">Printing Compiled Code</a></td></tr></table></div></div><div class="maincolumn"><div class="main"><div class="navsettop"><span class="navleft"><form class="searchform"><input class="searchbox" style="color: #888;" type="text" value="...search manuals..." title="Enter a search string to search the manuals" onkeypress="return DoSearchKey(event, this, "6.7", "../");" onfocus="this.style.color="black"; this.style.textAlign="left"; if (this.value == "...search manuals...") this.value="";" onblur="if (this.value.match(/^ *$/)) { this.style.color="#888"; this.style.textAlign="center"; this.value="...search manuals..."; }"/></form> <a href="../index.html" title="up to the documentation top" data-pltdoc="x" onclick="return GotoPLTRoot("6.7");">top</a></span><span class="navright"> <a href="reader.html" title="backward to "1.3 The Reader"" data-pltdoc="x">← prev</a> <a href="model.html" title="up to "1 Language Model"" data-pltdoc="x">up</a> <a href="notation.html" title="forward to "2 Notation for Documentation"" data-pltdoc="x">next →</a></span> </div><h4 x-source-module="(lib "scribblings/reference/reference.scrbl")" x-source-pkg="racket-doc" x-part-tag=""printing"">1.4<tt> </tt><a name="(part._printing)"></a>The Printer</h4><p>The Racket printer supports three modes:</p><ul><li><p><span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._write%29%29" class="RktValLink" data-pltdoc="x">write</a></span> mode prints core datatypes in such a way that
using <span class="RktSym"><a href="Reading.html#%28def._%28%28quote._~23~25kernel%29._read%29%29" class="RktValLink" data-pltdoc="x">read</a></span> on the output produces a value that is
<span class="RktSym"><a href="booleans.html#%28def._%28%28quote._~23~25kernel%29._equal~3f%29%29" class="RktValLink" data-pltdoc="x">equal?</a></span> to the printed value;</p></li><li><p><span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._display%29%29" class="RktValLink" data-pltdoc="x">display</a></span> mode prints core datatypes in a more
“end-user” style rather than “programmer” style; for
example, a string <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._display%29%29" class="RktValLink" data-pltdoc="x">display</a></span>s as its content characters
without surrounding <span class="RktInBG"><span class="hspace"></span><span class="RktIn">"</span><span class="hspace"></span></span>s or escapes;</p></li><li><p><span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print%29%29" class="RktValLink" data-pltdoc="x">print</a></span> mode by default—<wbr></wbr>when
<span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print-as-expression%29%29" class="RktValLink" data-pltdoc="x">print-as-expression</a></span> is <span class="RktVal">#t</span>—<wbr></wbr>prints most
datatypes in such a way that evaluating the output as an
expression produces a value that is <span class="RktSym"><a href="booleans.html#%28def._%28%28quote._~23~25kernel%29._equal~3f%29%29" class="RktValLink" data-pltdoc="x">equal?</a></span> to the
printed value; when <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print-as-expression%29%29" class="RktValLink" data-pltdoc="x">print-as-expression</a></span> is set to
<span class="RktVal">#f</span>, then <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print%29%29" class="RktValLink" data-pltdoc="x">print</a></span> mode is like <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._write%29%29" class="RktValLink" data-pltdoc="x">write</a></span>
mode.</p></li></ul><p>In <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print%29%29" class="RktValLink" data-pltdoc="x">print</a></span> mode when <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print-as-expression%29%29" class="RktValLink" data-pltdoc="x">print-as-expression</a></span> is
<span class="RktVal">#t</span> (as is the default), a value prints at a <a name="(tech._quoting._depth)"></a><span style="font-style: italic">quoting
depth</span> of either <span class="RktVal">0</span> (unquoted) or <span class="RktVal">1</span> (quoted). The
initial quoting depth is accepted as an optional argument by
<span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print%29%29" class="RktValLink" data-pltdoc="x">print</a></span>, and printing of some compound datatypes adjusts the
print depth for component values. For example, when a list is printed
at quoting depth <span class="RktVal">0</span> and all of its elements are
<a name="(tech._quotable)"></a><span style="font-style: italic">quotable</span>, the list is printed with a <span class="RktInBG"><span class="hspace"></span><span class="RktIn">'</span><span class="hspace"></span></span> prefix, and
the list’s elements are printed at quoting depth <span class="RktVal">1</span>.</p><p>When the <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print-graph%29%29" class="RktValLink" data-pltdoc="x">print-graph</a></span> parameter is set to <span class="RktVal">#t</span>, then
the printer first scans an object to detect cycles. The scan traverses
the components of pairs, mutable pairs, vectors, boxes (when
<span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print-box%29%29" class="RktValLink" data-pltdoc="x">print-box</a></span> is <span class="RktVal">#t</span>), hash tables (when
<span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print-hash-table%29%29" class="RktValLink" data-pltdoc="x">print-hash-table</a></span> is <span class="RktVal">#t</span>), fields of structures
exposed by <span class="RktSym"><a href="structutils.html#%28def._%28%28quote._~23~25kernel%29._struct-~3evector%29%29" class="RktValLink" data-pltdoc="x">struct->vector</a></span> (when <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print-struct%29%29" class="RktValLink" data-pltdoc="x">print-struct</a></span> is
<span class="RktVal">#t</span>), and fields of structures exposed by printing when the
structure’s type has the <span class="RktSym"><a href="Printer_Extension.html#%28def._%28%28quote._~23~25kernel%29._prop~3acustom-write%29%29" class="RktValLink" data-pltdoc="x">prop:custom-write</a></span> property. If
<span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print-graph%29%29" class="RktValLink" data-pltdoc="x">print-graph</a></span> is <span class="RktVal">#t</span>, then this information is used to
print sharing through graph definitions and references (see
<a href="reader.html#%28part._parse-graph%29" data-pltdoc="x">Reading Graph Structure</a>). If a cycle is detected in the initial scan,
then <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print-graph%29%29" class="RktValLink" data-pltdoc="x">print-graph</a></span> is effectively set to <span class="RktVal">#t</span>
automatically.</p><p>With the exception of displaying <a href="bytestrings.html#%28tech._byte._string%29" class="techoutside" data-pltdoc="x"><span class="techinside">byte strings</span></a>, printing is defined in
terms of Unicode characters; see <a href="ports.html" data-pltdoc="x">Ports</a> for information
on how a character stream is written to a port’s underlying byte
stream.</p><h5 x-source-module="(lib "scribblings/reference/reference.scrbl")" x-source-pkg="racket-doc" x-part-tag=""print-symbol"">1.4.1<tt> </tt><a name="(part._print-symbol)"></a>Printing Symbols</h5><p><a href="symbols.html#%28tech._symbol%29" class="techoutside" data-pltdoc="x"><span class="techinside">Symbols</span></a> containing spaces or special characters <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._write%29%29" class="RktValLink" data-pltdoc="x">write</a></span> using
escaping <span class="RktInBG"><span class="hspace"></span><span class="RktIn">\</span><span class="hspace"></span></span> and quoting <span class="RktInBG"><span class="hspace"></span><span class="RktIn">|</span><span class="hspace"></span></span>s. When the
<span class="RktSym"><a href="Reading.html#%28def._%28%28quote._~23~25kernel%29._read-case-sensitive%29%29" class="RktValLink" data-pltdoc="x">read-case-sensitive</a></span> parameter is set to <span class="RktVal">#f</span>, then
symbols containing uppercase characters also use escaping
<span class="RktInBG"><span class="hspace"></span><span class="RktIn">\</span><span class="hspace"></span></span> and quoting <span class="RktInBG"><span class="hspace"></span><span class="RktIn">|</span><span class="hspace"></span></span>s. In addition, symbols are
quoted with <span class="RktInBG"><span class="hspace"></span><span class="RktIn">|</span><span class="hspace"></span></span>s or leading <span class="RktInBG"><span class="hspace"></span><span class="RktIn">\</span><span class="hspace"></span></span> when they would
otherwise print the same as a numerical constant or as a delimited
<span class="RktInBG"><span class="hspace"></span><span class="RktIn">.</span><span class="hspace"></span></span> (when <span class="RktSym"><a href="Reading.html#%28def._%28%28quote._~23~25kernel%29._read-accept-dot%29%29" class="RktValLink" data-pltdoc="x">read-accept-dot</a></span> is <span class="RktVal">#t</span>).</p><p>When <span class="RktSym"><a href="Reading.html#%28def._%28%28quote._~23~25kernel%29._read-accept-bar-quote%29%29" class="RktValLink" data-pltdoc="x">read-accept-bar-quote</a></span> is <span class="RktVal">#t</span>, <span class="RktInBG"><span class="hspace"></span><span class="RktIn">|</span><span class="hspace"></span></span>s are
used in printing when one <span class="RktInBG"><span class="hspace"></span><span class="RktIn">|</span><span class="hspace"></span></span> at the beginning and one
<span class="RktInBG"><span class="hspace"></span><span class="RktIn">|</span><span class="hspace"></span></span> at the end suffice to correctly print the
symbol. Otherwise, <span class="RktInBG"><span class="hspace"></span><span class="RktIn">\</span><span class="hspace"></span></span>s are always used to escape special
characters, instead of quoting them with <span class="RktInBG"><span class="hspace"></span><span class="RktIn">|</span><span class="hspace"></span></span>s.</p><p>When <span class="RktSym"><a href="Reading.html#%28def._%28%28quote._~23~25kernel%29._read-accept-bar-quote%29%29" class="RktValLink" data-pltdoc="x">read-accept-bar-quote</a></span> is <span class="RktVal">#f</span>, then <span class="RktInBG"><span class="hspace"></span><span class="RktIn">|</span><span class="hspace"></span></span>
is not treated as a special character. The following are always
special characters:</p><p><span class="hspace"> </span> <span class="RktInBG"><span class="hspace"></span><span class="RktIn">(</span><span class="hspace"></span></span> <span class="RktInBG"><span class="hspace"></span><span class="RktIn">)</span><span class="hspace"></span></span> <span class="RktInBG"><span class="hspace"></span><span class="RktIn">[</span><span class="hspace"></span></span> <span class="RktInBG"><span class="hspace"></span><span class="RktIn">]</span><span class="hspace"></span></span>
<span class="RktInBG"><span class="hspace"></span><span class="RktIn">}</span><span class="hspace"></span></span> <span class="RktInBG"><span class="hspace"></span><span class="RktIn">}</span><span class="hspace"></span></span>
<span class="RktInBG"><span class="hspace"></span><span class="RktIn">"</span><span class="hspace"></span></span> <span class="RktInBG"><span class="hspace"></span><span class="RktIn">,</span><span class="hspace"></span></span> <span class="RktInBG"><span class="hspace"></span><span class="RktIn">'</span><span class="hspace"></span></span> <span class="RktInBG"><span class="hspace"></span><span class="RktIn">`</span><span class="hspace"></span></span>
<span class="RktInBG"><span class="hspace"></span><span class="RktIn">;</span><span class="hspace"></span></span> <span class="RktInBG"><span class="hspace"></span><span class="RktIn">\</span><span class="hspace"></span></span></p><p>In addition, <span class="RktInBG"><span class="hspace"></span><span class="RktIn">#</span><span class="hspace"></span></span> is a special character when it appears at the
beginning of the symbol, and when it is not followed by <span class="RktInBG"><span class="hspace"></span><span class="RktIn">%</span><span class="hspace"></span></span>.</p><p>Symbols <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._display%29%29" class="RktValLink" data-pltdoc="x">display</a></span> without escaping or quoting special
characters. That is, the display form of a symbol is the same as the
display form of <span class="RktSym"><a href="symbols.html#%28def._%28%28quote._~23~25kernel%29._symbol-~3estring%29%29" class="RktValLink" data-pltdoc="x">symbol->string</a></span> applied to the symbol.</p><p>Symbols <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print%29%29" class="RktValLink" data-pltdoc="x">print</a></span> the same as they <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._write%29%29" class="RktValLink" data-pltdoc="x">write</a></span>, unless
<span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print-as-expression%29%29" class="RktValLink" data-pltdoc="x">print-as-expression</a></span> is set to <span class="RktVal">#t</span> (as is the default) and the current
<a href="#%28tech._quoting._depth%29" class="techoutside" data-pltdoc="x"><span class="techinside">quoting depth</span></a> is <span class="RktVal">0</span>. In that case, the symbol’s
<span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print%29%29" class="RktValLink" data-pltdoc="x">print</a></span>ed form is prefixed with <span class="RktInBG"><span class="hspace"></span><span class="RktIn">'</span><span class="hspace"></span></span>. For the purposes
of printing enclosing datatypes, a symbol is <a href="#%28tech._quotable%29" class="techoutside" data-pltdoc="x"><span class="techinside">quotable</span></a>.</p><h5 x-source-module="(lib "scribblings/reference/reference.scrbl")" x-source-pkg="racket-doc" x-part-tag=""print-number"">1.4.2<tt> </tt><a name="(part._print-number)"></a>Printing Numbers</h5><p>A <a href="numbers.html#%28tech._number%29" class="techoutside" data-pltdoc="x"><span class="techinside">number</span></a> prints the same way in <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._write%29%29" class="RktValLink" data-pltdoc="x">write</a></span>, <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._display%29%29" class="RktValLink" data-pltdoc="x">display</a></span>, and
<span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print%29%29" class="RktValLink" data-pltdoc="x">print</a></span> modes. For the purposes of printing enclosing
datatypes, a number is <a href="#%28tech._quotable%29" class="techoutside" data-pltdoc="x"><span class="techinside">quotable</span></a>.</p><p>A <a href="numbers.html#%28tech._complex._number%29" class="techoutside" data-pltdoc="x"><span class="techinside">complex number</span></a> that is not a <a href="numbers.html#%28tech._real._number%29" class="techoutside" data-pltdoc="x"><span class="techinside">real number</span></a> always prints
as <span class="sroman">‹<span style="font-style: italic">m</span>›</span><span class="RktInBG"><span class="hspace"></span><span class="RktIn">+</span><span class="hspace"></span></span><span class="sroman">‹<span style="font-style: italic">n</span>›</span><span class="RktInBG"><span class="hspace"></span><span class="RktIn">i</span><span class="hspace"></span></span> or
<span class="sroman">‹<span style="font-style: italic">m</span>›</span><span class="RktInBG"><span class="hspace"></span><span class="RktIn">-</span><span class="hspace"></span></span><span class="sroman">‹<span style="font-style: italic">n</span>›</span><span class="RktInBG"><span class="hspace"></span><span class="RktIn">i</span><span class="hspace"></span></span>, where <span class="sroman">‹<span style="font-style: italic">m</span>›</span> and
<span class="sroman">‹<span style="font-style: italic">n</span>›</span> (for a non-negative imaginary part) or
<span class="RktInBG"><span class="hspace"></span><span class="RktIn">-</span><span class="hspace"></span></span><span class="sroman">‹<span style="font-style: italic">n</span>›</span> (for a negative imaginary part) are the printed
forms of its real and imaginary parts, respectively.</p><p>An exact <span class="RktVal">0</span> prints as <span class="RktInBG"><span class="hspace"></span><span class="RktIn">0</span><span class="hspace"></span></span>. A positive, exact
<a href="numbers.html#%28tech._integer%29" class="techoutside" data-pltdoc="x"><span class="techinside">integer</span></a> prints as a sequence of digits that does not start with
<span class="RktInBG"><span class="hspace"></span><span class="RktIn">0</span><span class="hspace"></span></span>. A positive, exact, real, non-integer number prints as
<span class="sroman">‹<span style="font-style: italic">m</span>›</span><span class="RktInBG"><span class="hspace"></span><span class="RktIn">/</span><span class="hspace"></span></span><span class="sroman">‹<span style="font-style: italic">n</span>›</span>, where <span class="sroman">‹<span style="font-style: italic">m</span>›</span> and <span class="sroman">‹<span style="font-style: italic">n</span>›</span>
are the printed forms of the number’s numerator and denominator (as
determined by <span class="RktSym"><a href="generic-numbers.html#%28def._%28%28quote._~23~25kernel%29._numerator%29%29" class="RktValLink" data-pltdoc="x">numerator</a></span> and <span class="RktSym"><a href="generic-numbers.html#%28def._%28%28quote._~23~25kernel%29._denominator%29%29" class="RktValLink" data-pltdoc="x">denominator</a></span>). A negative
<a href="numbers.html#%28tech._exact._number%29" class="techoutside" data-pltdoc="x"><span class="techinside">exact number</span></a> prints with a <span class="RktInBG"><span class="hspace"></span><span class="RktIn">-</span><span class="hspace"></span></span> prefix on the printed
form of the number’s exact negation. When printing a number as
hexadecimal (e.g., via <span class="RktSym"><a href="generic-numbers.html#%28def._%28%28quote._~23~25kernel%29._number-~3estring%29%29" class="RktValLink" data-pltdoc="x">number->string</a></span>), digits <span class="RktInBG"><span class="hspace"></span><span class="RktIn">a</span><span class="hspace"></span></span>
though <span class="RktInBG"><span class="hspace"></span><span class="RktIn">f</span><span class="hspace"></span></span> are printed in lowercase. A <span class="RktInBG"><span class="hspace"></span><span class="RktIn">#e</span><span class="hspace"></span></span> or radix
marker such as <span class="RktInBG"><span class="hspace"></span><span class="RktIn">#d</span><span class="hspace"></span></span> <span style="font-style: italic">does not</span> prefix the number.</p><p>A double-precision <a href="numbers.html#%28tech._inexact._number%29" class="techoutside" data-pltdoc="x"><span class="techinside">inexact number</span></a> (i.e., a <a href="numbers.html#%28tech._flonum%29" class="techoutside" data-pltdoc="x"><span class="techinside">flonum</span></a>) that
is a <a href="numbers.html#%28tech._rational._number%29" class="techoutside" data-pltdoc="x"><span class="techinside">rational number</span></a> prints with either a <span class="RktInBG"><span class="hspace"></span><span class="RktIn">.</span><span class="hspace"></span></span> decimal
point, an <span class="RktInBG"><span class="hspace"></span><span class="RktIn">e</span><span class="hspace"></span></span> exponent marker and non-zero exponent, or both.
The form is selected to keep the output short, with
the constraint that reading the printed form back in produces an
<span class="RktSym"><a href="booleans.html#%28def._%28%28quote._~23~25kernel%29._equal~3f%29%29" class="RktValLink" data-pltdoc="x">equal?</a></span> number. A <span class="RktInBG"><span class="hspace"></span><span class="RktIn">#i</span><span class="hspace"></span></span> <span style="font-style: italic">does not</span> prefix the
number, and <span class="RktInBG"><span class="hspace"></span><span class="RktIn">#</span><span class="hspace"></span></span> is never used in place of a digit. A
<span class="RktInBG"><span class="hspace"></span><span class="RktIn">+</span><span class="hspace"></span></span> does not prefix a positive number, but a <span class="RktInBG"><span class="hspace"></span><span class="RktIn">+</span><span class="hspace"></span></span> or
<span class="RktInBG"><span class="hspace"></span><span class="RktIn">-</span><span class="hspace"></span></span> is printed before the exponent if <span class="RktInBG"><span class="hspace"></span><span class="RktIn">e</span><span class="hspace"></span></span> is present.
Positive infinity prints as <span class="RktInBG"><span class="hspace"></span><span class="RktIn">+inf.0</span><span class="hspace"></span></span>, negative infinity prints
as <span class="RktInBG"><span class="hspace"></span><span class="RktIn">-inf.0</span><span class="hspace"></span></span>, and not-a-number prints as <span class="RktInBG"><span class="hspace"></span><span class="RktIn">+nan.0</span><span class="hspace"></span></span>.</p><p>A single-precision <a href="numbers.html#%28tech._inexact._number%29" class="techoutside" data-pltdoc="x"><span class="techinside">inexact number</span></a> that is a <a href="numbers.html#%28tech._rational._number%29" class="techoutside" data-pltdoc="x"><span class="techinside">rational
number</span></a> prints like a double-precision number, but always with an
exponent, using <span class="RktInBG"><span class="hspace"></span><span class="RktIn">f</span><span class="hspace"></span></span> in place of <span class="RktInBG"><span class="hspace"></span><span class="RktIn">e</span><span class="hspace"></span></span> to indicate the
number’s precision; if the number would otherwise print without an
exponent, <span class="RktInBG"><span class="hspace"></span><span class="RktIn">0</span><span class="hspace"></span></span> (with no <span class="RktInBG"><span class="hspace"></span><span class="RktIn">+</span><span class="hspace"></span></span>) is printed as the exponent
part. Single-precision positive infinity prints as
<span class="RktInBG"><span class="hspace"></span><span class="RktIn">+inf.f</span><span class="hspace"></span></span>, negative infinity prints as <span class="RktInBG"><span class="hspace"></span><span class="RktIn">-inf.f</span><span class="hspace"></span></span>, and
not-a-number prints as <span class="RktInBG"><span class="hspace"></span><span class="RktIn">+nan.f</span><span class="hspace"></span></span>.</p><h5 x-source-module="(lib "scribblings/reference/reference.scrbl")" x-source-pkg="racket-doc" x-part-tag=""print-extflonum"">1.4.3<tt> </tt><a name="(part._print-extflonum)"></a>Printing Extflonums</h5><p>An <a href="extflonums.html#%28tech._extflonum%29" class="techoutside" data-pltdoc="x"><span class="techinside">extflonum</span></a> prints the same way in <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._write%29%29" class="RktValLink" data-pltdoc="x">write</a></span>,
<span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._display%29%29" class="RktValLink" data-pltdoc="x">display</a></span>, and <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print%29%29" class="RktValLink" data-pltdoc="x">print</a></span> modes. For the purposes of
printing enclosing datatypes, an extflonum is <a href="#%28tech._quotable%29" class="techoutside" data-pltdoc="x"><span class="techinside">quotable</span></a>.</p><p>An extflonum prints in the same way a single-precision inexact number
(see <a href="#%28part._print-number%29" data-pltdoc="x">Printing Numbers</a>), but always with a <span class="RktInBG"><span class="hspace"></span><span class="RktIn">t</span><span class="hspace"></span></span> or
<span class="RktInBG"><span class="hspace"></span><span class="RktIn">T</span><span class="hspace"></span></span> exponent marker or as a suffix for <span class="RktInBG"><span class="hspace"></span><span class="RktIn">+inf.t</span><span class="hspace"></span></span>, <span class="RktInBG"><span class="hspace"></span><span class="RktIn">-inf.t</span><span class="hspace"></span></span>,
or <span class="RktInBG"><span class="hspace"></span><span class="RktIn">+nan.t</span><span class="hspace"></span></span>. When
extflonum operations are supported, printing always uses lowercase
<span class="RktInBG"><span class="hspace"></span><span class="RktIn">t</span><span class="hspace"></span></span>; when extflonum operations are not supported, an
extflonum prints the same as its reader (see <a href="reader.html" data-pltdoc="x">The Reader</a>)
source, since reading is the only way to produce an extflonum.</p><h5 x-source-module="(lib "scribblings/reference/reference.scrbl")" x-source-pkg="racket-doc" x-part-tag=""print-booleans"">1.4.4<tt> </tt><a name="(part._print-booleans)"></a>Printing Booleans</h5><p>The <a href="booleans.html#%28tech._boolean%29" class="techoutside" data-pltdoc="x"><span class="techinside">boolean</span></a> constant <span class="RktVal">#t</span> prints as <span class="RktInBG"><span class="hspace"></span><span class="RktIn">#true</span><span class="hspace"></span></span> or <span class="RktInBG"><span class="hspace"></span><span class="RktIn">#t</span><span class="hspace"></span></span> in
all modes (<span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._display%29%29" class="RktValLink" data-pltdoc="x">display</a></span>, <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._write%29%29" class="RktValLink" data-pltdoc="x">write</a></span>, and <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print%29%29" class="RktValLink" data-pltdoc="x">print</a></span>),
depending on the value of <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print-boolean-long-form%29%29" class="RktValLink" data-pltdoc="x">print-boolean-long-form</a></span>, and the
constant <span class="RktVal">#f</span> prints as <span class="RktInBG"><span class="hspace"></span><span class="RktIn">#false</span><span class="hspace"></span></span> or <span class="RktInBG"><span class="hspace"></span><span class="RktIn">#f</span><span class="hspace"></span></span>. For
the purposes of printing enclosing datatypes, a symbol is
<a href="#%28tech._quotable%29" class="techoutside" data-pltdoc="x"><span class="techinside">quotable</span></a>.</p><h5 x-source-module="(lib "scribblings/reference/reference.scrbl")" x-source-pkg="racket-doc" x-part-tag=""print-pairs"">1.4.5<tt> </tt><a name="(part._print-pairs)"></a>Printing Pairs and Lists</h5><p>In <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._write%29%29" class="RktValLink" data-pltdoc="x">write</a></span> and <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._display%29%29" class="RktValLink" data-pltdoc="x">display</a></span> modes, an empty <a href="pairs.html#%28tech._list%29" class="techoutside" data-pltdoc="x"><span class="techinside">list</span></a> prints as
<span class="RktInBG"><span class="hspace"></span><span class="RktIn">()</span><span class="hspace"></span></span>. A <a href="pairs.html#%28tech._pair%29" class="techoutside" data-pltdoc="x"><span class="techinside">pair</span></a> normally prints starting with <span class="RktInBG"><span class="hspace"></span><span class="RktIn">(</span><span class="hspace"></span></span>
followed by the printed form of its <span class="RktSym"><a href="pairs.html#%28def._%28%28quote._~23~25kernel%29._car%29%29" class="RktValLink" data-pltdoc="x">car</a></span>. The rest of the
printed form depends on the <span class="RktSym"><a href="pairs.html#%28def._%28%28quote._~23~25kernel%29._cdr%29%29" class="RktValLink" data-pltdoc="x">cdr</a></span>:</p><ul><li><p>If the <span class="RktSym"><a href="pairs.html#%28def._%28%28quote._~23~25kernel%29._cdr%29%29" class="RktValLink" data-pltdoc="x">cdr</a></span> is a pair or the empty list, then the
printed form of the pair completes with the printed form of the
<span class="RktSym"><a href="pairs.html#%28def._%28%28quote._~23~25kernel%29._cdr%29%29" class="RktValLink" data-pltdoc="x">cdr</a></span>, except that the leading <span class="RktInBG"><span class="hspace"></span><span class="RktIn">(</span><span class="hspace"></span></span> in the
<span class="RktSym"><a href="pairs.html#%28def._%28%28quote._~23~25kernel%29._cdr%29%29" class="RktValLink" data-pltdoc="x">cdr</a></span>’s printed form is omitted.</p></li><li><p>Otherwise, the printed for of the pair continues with a space,
<span class="RktInBG"><span class="hspace"></span><span class="RktIn">.</span><span class="hspace"></span></span>, another space, the printed form of the
<span class="RktSym"><a href="pairs.html#%28def._%28%28quote._~23~25kernel%29._cdr%29%29" class="RktValLink" data-pltdoc="x">cdr</a></span>, and a <span class="RktInBG"><span class="hspace"></span><span class="RktIn">)</span><span class="hspace"></span></span>.</p></li></ul><p>If <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print-reader-abbreviations%29%29" class="RktValLink" data-pltdoc="x">print-reader-abbreviations</a></span> is set to <span class="RktVal">#t</span>, then
pair printing in <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._write%29%29" class="RktValLink" data-pltdoc="x">write</a></span> mode is adjusted in the case of a pair
that starts a two-element list whose first element is <span class="RktVal">'</span><span class="RktVal">quote</span>,
<span class="RktVal">'</span><span class="RktVal">quasiquote</span>, <span class="RktVal">'</span><span class="RktVal">unquote</span>, <span class="RktVal">'</span><span class="RktVal">unquote-splicing</span>,
<span class="RktVal">'</span><span class="RktVal">syntax</span>, <span class="RktVal">'</span><span class="RktVal">quasisyntax</span>, <span class="RktVal">'</span><span class="RktVal">unsyntax</span>, or
<span class="RktVal">'</span><span class="RktVal">unsyntax-splicing</span>. In that case, the pair is printed with
the corresponding reader syntax: <span class="RktInBG"><span class="hspace"></span><span class="RktIn">'</span><span class="hspace"></span></span>, <span class="RktInBG"><span class="hspace"></span><span class="RktIn">`</span><span class="hspace"></span></span>,
<span class="RktInBG"><span class="hspace"></span><span class="RktIn">,</span><span class="hspace"></span></span>, <span class="RktInBG"><span class="hspace"></span><span class="RktIn">,@</span><span class="hspace"></span></span>, <span class="RktInBG"><span class="hspace"></span><span class="RktIn">#'</span><span class="hspace"></span></span>, <span class="RktInBG"><span class="hspace"></span><span class="RktIn">#`</span><span class="hspace"></span></span>, <span class="RktInBG"><span class="hspace"></span><span class="RktIn">#,</span><span class="hspace"></span></span>,
or <span class="RktInBG"><span class="hspace"></span><span class="RktIn">#,@</span><span class="hspace"></span></span>, respectively. After the reader syntax, the second
element of the list is printed. When the list is a tail of an
enclosing list, the tail is printed after a <span class="RktInBG"><span class="hspace"></span><span class="RktIn">.</span><span class="hspace"></span></span> in the
enclosing list (after which the reader abbreviations work), instead of
including the tail as two elements of the enclosing list.</p><p>The printed form of a pair is the same in both <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._write%29%29" class="RktValLink" data-pltdoc="x">write</a></span> and
<span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._display%29%29" class="RktValLink" data-pltdoc="x">display</a></span> modes, except as the printed form of the pair’s
<span class="RktSym"><a href="pairs.html#%28def._%28%28quote._~23~25kernel%29._car%29%29" class="RktValLink" data-pltdoc="x">car</a></span> and <span class="RktSym"><a href="pairs.html#%28def._%28%28quote._~23~25kernel%29._cdr%29%29" class="RktValLink" data-pltdoc="x">cdr</a></span> vary with the mode. The <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print%29%29" class="RktValLink" data-pltdoc="x">print</a></span>
form is also the same if <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print-as-expression%29%29" class="RktValLink" data-pltdoc="x">print-as-expression</a></span> is <span class="RktVal">#f</span>
or the quoting depth is <span class="RktVal">1</span>.</p><p>For <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print%29%29" class="RktValLink" data-pltdoc="x">print</a></span> mode when <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print-as-expression%29%29" class="RktValLink" data-pltdoc="x">print-as-expression</a></span> is
<span class="RktVal">#t</span> and the <a href="#%28tech._quoting._depth%29" class="techoutside" data-pltdoc="x"><span class="techinside">quoting depth</span></a> is <span class="RktVal">0</span>, then the empty
list prints as <span class="RktInBG"><span class="hspace"></span><span class="RktIn">'()</span><span class="hspace"></span></span>. For a pair whose <span class="RktSym"><a href="pairs.html#%28def._%28%28quote._~23~25kernel%29._car%29%29" class="RktValLink" data-pltdoc="x">car</a></span> and
<span class="RktSym"><a href="pairs.html#%28def._%28%28quote._~23~25kernel%29._cdr%29%29" class="RktValLink" data-pltdoc="x">cdr</a></span> are <a href="#%28tech._quotable%29" class="techoutside" data-pltdoc="x"><span class="techinside">quotable</span></a>, the pair prints in <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._write%29%29" class="RktValLink" data-pltdoc="x">write</a></span>
mode but with a <span class="RktInBG"><span class="hspace"></span><span class="RktIn">'</span><span class="hspace"></span></span> prefix; the pair’s content is printed with
<a href="#%28tech._quoting._depth%29" class="techoutside" data-pltdoc="x"><span class="techinside">quoting depth</span></a> <span class="RktVal">1</span>. Otherwise, when the <span class="RktSym"><a href="pairs.html#%28def._%28%28quote._~23~25kernel%29._car%29%29" class="RktValLink" data-pltdoc="x">car</a></span> or
<span class="RktSym"><a href="pairs.html#%28def._%28%28quote._~23~25kernel%29._cdr%29%29" class="RktValLink" data-pltdoc="x">cdr</a></span> is not <a href="#%28tech._quotable%29" class="techoutside" data-pltdoc="x"><span class="techinside">quotable</span></a>, then pair prints with either
<span class="RktInBG"><span class="hspace"></span><span class="RktIn">cons</span><span class="hspace"></span></span> (when the <span class="RktSym"><a href="pairs.html#%28def._%28%28quote._~23~25kernel%29._cdr%29%29" class="RktValLink" data-pltdoc="x">cdr</a></span> is not a pair), <span class="RktInBG"><span class="hspace"></span><span class="RktIn">list</span><span class="hspace"></span></span>
(when the pair is a list), or <span class="RktInBG"><span class="hspace"></span><span class="RktIn">list*</span><span class="hspace"></span></span> (otherwise) after the
opening <span class="RktInBG"><span class="hspace"></span><span class="RktIn">(</span><span class="hspace"></span></span>, any <span class="RktInBG"><span class="hspace"></span><span class="RktIn">.</span><span class="hspace"></span></span> that would otherwise be printed
is suppressed, and the pair content is printed at <a href="#%28tech._quoting._depth%29" class="techoutside" data-pltdoc="x"><span class="techinside">quoting depth</span></a>
<span class="RktVal">0</span>. In all cases, when <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print-as-expression%29%29" class="RktValLink" data-pltdoc="x">print-as-expression</a></span> is
<span class="RktVal">#t</span> for <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print%29%29" class="RktValLink" data-pltdoc="x">print</a></span> mode, then the value of
<span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print-reader-abbreviations%29%29" class="RktValLink" data-pltdoc="x">print-reader-abbreviations</a></span> is ignored and reader
abbreviations are always used for lists printed at <a href="#%28tech._quoting._depth%29" class="techoutside" data-pltdoc="x"><span class="techinside">quoting
depth</span></a> <span class="RktVal">1</span>.</p><p>By default, mutable pairs (as created with <span class="RktSym"><a href="mpairs.html#%28def._%28%28quote._~23~25kernel%29._mcons%29%29" class="RktValLink" data-pltdoc="x">mcons</a></span>) print the
same as pairs for <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._write%29%29" class="RktValLink" data-pltdoc="x">write</a></span> and <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._display%29%29" class="RktValLink" data-pltdoc="x">display</a></span>, except that
<span class="RktInBG"><span class="hspace"></span><span class="RktIn">{</span><span class="hspace"></span></span> and <span class="RktInBG"><span class="hspace"></span><span class="RktIn">}</span><span class="hspace"></span></span> are used instead of <span class="RktInBG"><span class="hspace"></span><span class="RktIn">(</span><span class="hspace"></span></span> and
<span class="RktInBG"><span class="hspace"></span><span class="RktIn">)</span><span class="hspace"></span></span>. Note that the reader treats <span class="RktInBG"><span class="hspace"></span><span class="RktIn">{</span><span class="hspace"></span></span>...<span class="RktInBG"><span class="hspace"></span><span class="RktIn">}</span><span class="hspace"></span></span>
and <span class="RktInBG"><span class="hspace"></span><span class="RktIn">(</span><span class="hspace"></span></span>...<span class="RktInBG"><span class="hspace"></span><span class="RktIn">)</span><span class="hspace"></span></span> equivalently on input, creating
immutable pairs in both cases. Mutable pairs in <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print%29%29" class="RktValLink" data-pltdoc="x">print</a></span> mode with
<span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print-as-expression%29%29" class="RktValLink" data-pltdoc="x">print-as-expression</a></span> as <span class="RktVal">#f</span> or a <a href="#%28tech._quoting._depth%29" class="techoutside" data-pltdoc="x"><span class="techinside">quoting depth</span></a>
of <span class="RktVal">1</span> also use <span class="RktInBG"><span class="hspace"></span><span class="RktIn">{</span><span class="hspace"></span></span> and <span class="RktInBG"><span class="hspace"></span><span class="RktIn">}</span><span class="hspace"></span></span>. In
<span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print%29%29" class="RktValLink" data-pltdoc="x">print</a></span> mode with <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print-as-expression%29%29" class="RktValLink" data-pltdoc="x">print-as-expression</a></span> as <span class="RktVal">#t</span>
and a <a href="#%28tech._quoting._depth%29" class="techoutside" data-pltdoc="x"><span class="techinside">quoting depth</span></a> of <span class="RktVal">0</span>, a mutable pair prints as
<span class="RktInBG"><span class="hspace"></span><span class="RktIn">(mcons</span><span class="hspace"> </span></span>, the <span class="RktSym"><a href="mpairs.html#%28def._%28%28quote._~23~25kernel%29._mcar%29%29" class="RktValLink" data-pltdoc="x">mcar</a></span> and <span class="RktSym"><a href="mpairs.html#%28def._%28%28quote._~23~25kernel%29._mcdr%29%29" class="RktValLink" data-pltdoc="x">mcdr</a></span> printed at
<a href="#%28tech._quoting._depth%29" class="techoutside" data-pltdoc="x"><span class="techinside">quoting depth</span></a> <span class="RktVal">0</span> and separated by a space, and a
closing <span class="RktInBG"><span class="hspace"></span><span class="RktIn">)</span><span class="hspace"></span></span>.</p><p>If the <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print-pair-curly-braces%29%29" class="RktValLink" data-pltdoc="x">print-pair-curly-braces</a></span> parameter is set to
<span class="RktVal">#t</span>, then pairs print using <span class="RktInBG"><span class="hspace"></span><span class="RktIn">{</span><span class="hspace"></span></span> and <span class="RktInBG"><span class="hspace"></span><span class="RktIn">}</span><span class="hspace"></span></span>
when not using <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print%29%29" class="RktValLink" data-pltdoc="x">print</a></span> mode with <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print-as-expression%29%29" class="RktValLink" data-pltdoc="x">print-as-expression</a></span> as
<span class="RktVal">#t</span> and a <a href="#%28tech._quoting._depth%29" class="techoutside" data-pltdoc="x"><span class="techinside">quoting depth</span></a> of <span class="RktVal">0</span>. If the
<span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print-mpair-curly-braces%29%29" class="RktValLink" data-pltdoc="x">print-mpair-curly-braces</a></span> parameter is set to <span class="RktVal">#f</span>,
then mutable pairs print using <span class="RktInBG"><span class="hspace"></span><span class="RktIn">(</span><span class="hspace"></span></span> and <span class="RktInBG"><span class="hspace"></span><span class="RktIn">)</span><span class="hspace"></span></span> in that
mode.</p><p>For the purposes of printing enclosing datatypes, an empty list is
always <a href="#%28tech._quotable%29" class="techoutside" data-pltdoc="x"><span class="techinside">quotable</span></a>, a pair is <a href="#%28tech._quotable%29" class="techoutside" data-pltdoc="x"><span class="techinside">quotable</span></a> when its
<span class="RktSym"><a href="pairs.html#%28def._%28%28quote._~23~25kernel%29._car%29%29" class="RktValLink" data-pltdoc="x">car</a></span> and <span class="RktSym"><a href="pairs.html#%28def._%28%28quote._~23~25kernel%29._cdr%29%29" class="RktValLink" data-pltdoc="x">cdr</a></span> are <a href="#%28tech._quotable%29" class="techoutside" data-pltdoc="x"><span class="techinside">quotable</span></a>, and a mutable list
is never <a href="#%28tech._quotable%29" class="techoutside" data-pltdoc="x"><span class="techinside">quotable</span></a>.</p><h5 x-source-module="(lib "scribblings/reference/reference.scrbl")" x-source-pkg="racket-doc" x-part-tag=""print-string"">1.4.6<tt> </tt><a name="(part._print-string)"></a>Printing Strings</h5><p>All <a href="strings.html#%28tech._string%29" class="techoutside" data-pltdoc="x"><span class="techinside">strings</span></a> <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._display%29%29" class="RktValLink" data-pltdoc="x">display</a></span> as their literal character sequences.</p><p>The <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._write%29%29" class="RktValLink" data-pltdoc="x">write</a></span> or <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print%29%29" class="RktValLink" data-pltdoc="x">print</a></span> form of a string starts with <span class="RktInBG"><span class="hspace"></span><span class="RktIn">"</span><span class="hspace"></span></span> and ends
with another <span class="RktInBG"><span class="hspace"></span><span class="RktIn">"</span><span class="hspace"></span></span>. Between the <span class="RktInBG"><span class="hspace"></span><span class="RktIn">"</span><span class="hspace"></span></span>s, each character is
represented. Each graphic or blank character is represented as itself,
with two exceptions: <span class="RktInBG"><span class="hspace"></span><span class="RktIn">"</span><span class="hspace"></span></span> is printed as <span class="RktInBG"><span class="hspace"></span><span class="RktIn">\"</span><span class="hspace"></span></span>, and
<span class="RktInBG"><span class="hspace"></span><span class="RktIn">\</span><span class="hspace"></span></span> is printed as <span class="RktInBG"><span class="hspace"></span><span class="RktIn">\\</span><span class="hspace"></span></span>. Each non-graphic, non-blank
character (according to <span class="RktSym"><a href="characters.html#%28def._%28%28quote._~23~25kernel%29._char-graphic~3f%29%29" class="RktValLink" data-pltdoc="x">char-graphic?</a></span> and
<span class="RktSym"><a href="characters.html#%28def._%28%28quote._~23~25kernel%29._char-blank~3f%29%29" class="RktValLink" data-pltdoc="x">char-blank?</a></span>) is printed using the escape sequences described
in <a href="reader.html#%28part._parse-string%29" data-pltdoc="x">Reading Strings</a>, using <span class="RktInBG"><span class="hspace"></span><span class="RktIn">\a</span><span class="hspace"></span></span>, <span class="RktInBG"><span class="hspace"></span><span class="RktIn">\b</span><span class="hspace"></span></span>,
<span class="RktInBG"><span class="hspace"></span><span class="RktIn">\t</span><span class="hspace"></span></span>, <span class="RktInBG"><span class="hspace"></span><span class="RktIn">\n</span><span class="hspace"></span></span>, <span class="RktInBG"><span class="hspace"></span><span class="RktIn">\v</span><span class="hspace"></span></span>, <span class="RktInBG"><span class="hspace"></span><span class="RktIn">\f</span><span class="hspace"></span></span>, <span class="RktInBG"><span class="hspace"></span><span class="RktIn">\r</span><span class="hspace"></span></span>,
or <span class="RktInBG"><span class="hspace"></span><span class="RktIn">\e</span><span class="hspace"></span></span> if possible, otherwise using <span class="RktInBG"><span class="hspace"></span><span class="RktIn">\u</span><span class="hspace"></span></span> with four
hexadecimal digits or <span class="RktInBG"><span class="hspace"></span><span class="RktIn">\U</span><span class="hspace"></span></span> with eight hexadecimal digits
(using the latter only if the character value does not fit into four
digits).</p><p>All byte strings <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._display%29%29" class="RktValLink" data-pltdoc="x">display</a></span> as their literal byte sequence; this
byte sequence may not be a valid UTF-8 encoding, so it may not
correspond to a sequence of characters.</p><p>The <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._write%29%29" class="RktValLink" data-pltdoc="x">write</a></span> or <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print%29%29" class="RktValLink" data-pltdoc="x">print</a></span> form of a byte string starts with <span class="RktInBG"><span class="hspace"></span><span class="RktIn">#"</span><span class="hspace"></span></span> and
ends with a <span class="RktInBG"><span class="hspace"></span><span class="RktIn">"</span><span class="hspace"></span></span>. Between the <span class="RktInBG"><span class="hspace"></span><span class="RktIn">"</span><span class="hspace"></span></span>s, each byte is
written using the corresponding ASCII decoding if the byte is between
0 and 127 and the character is graphic or blank (according to
<span class="RktSym"><a href="characters.html#%28def._%28%28quote._~23~25kernel%29._char-graphic~3f%29%29" class="RktValLink" data-pltdoc="x">char-graphic?</a></span> and <span class="RktSym"><a href="characters.html#%28def._%28%28quote._~23~25kernel%29._char-blank~3f%29%29" class="RktValLink" data-pltdoc="x">char-blank?</a></span>). Otherwise, the byte
is written using <span class="RktInBG"><span class="hspace"></span><span class="RktIn">\a</span><span class="hspace"></span></span>, <span class="RktInBG"><span class="hspace"></span><span class="RktIn">\b</span><span class="hspace"></span></span>, <span class="RktInBG"><span class="hspace"></span><span class="RktIn">\t</span><span class="hspace"></span></span>,
<span class="RktInBG"><span class="hspace"></span><span class="RktIn">\n</span><span class="hspace"></span></span>, <span class="RktInBG"><span class="hspace"></span><span class="RktIn">\v</span><span class="hspace"></span></span>, <span class="RktInBG"><span class="hspace"></span><span class="RktIn">\f</span><span class="hspace"></span></span>, <span class="RktInBG"><span class="hspace"></span><span class="RktIn">\r</span><span class="hspace"></span></span>, or
<span class="RktInBG"><span class="hspace"></span><span class="RktIn">\e</span><span class="hspace"></span></span> if possible, otherwise using <span class="RktInBG"><span class="hspace"></span><span class="RktIn">\</span><span class="hspace"></span></span> followed by one
to three octal digits (only as many as necessary).</p><p>For the purposes of printing enclosing datatypes, a string or a byte
string is <a href="#%28tech._quotable%29" class="techoutside" data-pltdoc="x"><span class="techinside">quotable</span></a>.</p><h5 x-source-module="(lib "scribblings/reference/reference.scrbl")" x-source-pkg="racket-doc" x-part-tag=""print-vectors"">1.4.7<tt> </tt><a name="(part._print-vectors)"></a>Printing Vectors</h5><p>In <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._display%29%29" class="RktValLink" data-pltdoc="x">display</a></span> mode, the printed form of a <a href="vectors.html#%28tech._vector%29" class="techoutside" data-pltdoc="x"><span class="techinside">vector</span></a> is <span class="RktInBG"><span class="hspace"></span><span class="RktIn">#</span><span class="hspace"></span></span>
followed by the printed form of <span class="RktSym"><a href="vectors.html#%28def._%28%28quote._~23~25kernel%29._vector-~3elist%29%29" class="RktValLink" data-pltdoc="x">vector->list</a></span> applied to the
vector. In <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._write%29%29" class="RktValLink" data-pltdoc="x">write</a></span> mode, the printed form is the same, except
that when the <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print-vector-length%29%29" class="RktValLink" data-pltdoc="x">print-vector-length</a></span> parameter is <span class="RktVal">#t</span>, a
decimal integer is printed after the <span class="RktInBG"><span class="hspace"></span><span class="RktIn">#</span><span class="hspace"></span></span>, and a repeated last
element is printed only once.</p><p>Vectors <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print%29%29" class="RktValLink" data-pltdoc="x">print</a></span> the same as they <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._write%29%29" class="RktValLink" data-pltdoc="x">write</a></span>, unless
<span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print-as-expression%29%29" class="RktValLink" data-pltdoc="x">print-as-expression</a></span> is set to <span class="RktVal">#t</span> and the current
<a href="#%28tech._quoting._depth%29" class="techoutside" data-pltdoc="x"><span class="techinside">quoting depth</span></a> is <span class="RktVal">0</span>. In that case, if all of the
vector’s elements are <a href="#%28tech._quotable%29" class="techoutside" data-pltdoc="x"><span class="techinside">quotable</span></a>, then the vector’s
<span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print%29%29" class="RktValLink" data-pltdoc="x">print</a></span>ed form is prefixed with <span class="RktInBG"><span class="hspace"></span><span class="RktIn">'</span><span class="hspace"></span></span> and its elements
printed with <a href="#%28tech._quoting._depth%29" class="techoutside" data-pltdoc="x"><span class="techinside">quoting depth</span></a> <span class="RktVal">1</span>. If its elements are not
all <a href="#%28tech._quotable%29" class="techoutside" data-pltdoc="x"><span class="techinside">quotable</span></a>, then the vector <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print%29%29" class="RktValLink" data-pltdoc="x">print</a></span>s as
<span class="RktInBG"><span class="hspace"></span><span class="RktIn">(vector</span><span class="hspace"> </span></span>, the elements at <a href="#%28tech._quoting._depth%29" class="techoutside" data-pltdoc="x"><span class="techinside">quoting depth</span></a> <span class="RktVal">0</span>,
and a closing <span class="RktInBG"><span class="hspace"></span><span class="RktIn">)</span><span class="hspace"></span></span>. A vector is <a href="#%28tech._quotable%29" class="techoutside" data-pltdoc="x"><span class="techinside">quotable</span></a> when all of
its elements are <a href="#%28tech._quotable%29" class="techoutside" data-pltdoc="x"><span class="techinside">quotable</span></a>.</p><p>In <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._write%29%29" class="RktValLink" data-pltdoc="x">write</a></span> or <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._display%29%29" class="RktValLink" data-pltdoc="x">display</a></span> mode, a <a href="flonums.html#%28tech._flvector%29" class="techoutside" data-pltdoc="x"><span class="techinside">flvector</span></a> prints
like a <a href="vectors.html#%28tech._vector%29" class="techoutside" data-pltdoc="x"><span class="techinside">vector</span></a>, but with a <span class="RktInBG"><span class="hspace"></span><span class="RktIn">#fl</span><span class="hspace"></span></span> prefix instead of
<span class="RktInBG"><span class="hspace"></span><span class="RktIn">#</span><span class="hspace"></span></span>. A <a href="fixnums.html#%28tech._fxvector%29" class="techoutside" data-pltdoc="x"><span class="techinside">fxvector</span></a> similarly prints with a <span class="RktInBG"><span class="hspace"></span><span class="RktIn">#fx</span><span class="hspace"></span></span>
prefix instead of <span class="RktInBG"><span class="hspace"></span><span class="RktIn">#</span><span class="hspace"></span></span>. The <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print-vector-length%29%29" class="RktValLink" data-pltdoc="x">print-vector-length</a></span>
parameter affects <a href="flonums.html#%28tech._flvector%29" class="techoutside" data-pltdoc="x"><span class="techinside">flvector</span></a> and <a href="fixnums.html#%28tech._fxvector%29" class="techoutside" data-pltdoc="x"><span class="techinside">fxvector</span></a> printing the
same as <a href="vectors.html#%28tech._vector%29" class="techoutside" data-pltdoc="x"><span class="techinside">vector</span></a> printing. In <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print%29%29" class="RktValLink" data-pltdoc="x">print</a></span> mode,
<a href="flonums.html#%28tech._flvector%29" class="techoutside" data-pltdoc="x"><span class="techinside">flvectors</span></a> and <a href="fixnums.html#%28tech._fxvector%29" class="techoutside" data-pltdoc="x"><span class="techinside">fxvectors</span></a> are not <a href="#%28tech._quotable%29" class="techoutside" data-pltdoc="x"><span class="techinside">quotable</span></a>, and
they print like a <a href="vectors.html#%28tech._vector%29" class="techoutside" data-pltdoc="x"><span class="techinside">vector</span></a> at <a href="#%28tech._quoting._depth%29" class="techoutside" data-pltdoc="x"><span class="techinside">quoting depth</span></a> 0 using a
<span class="RktInBG"><span class="hspace"></span><span class="RktIn">(flvector</span><span class="hspace"> </span></span> or <span class="RktInBG"><span class="hspace"></span><span class="RktIn">(fxvector</span><span class="hspace"> </span></span> prefix, respectively.</p><h5 x-source-module="(lib "scribblings/reference/reference.scrbl")" x-source-pkg="racket-doc" x-part-tag=""print-structure"">1.4.8<tt> </tt><a name="(part._print-structure)"></a>Printing Structures</h5><p>When the <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print-struct%29%29" class="RktValLink" data-pltdoc="x">print-struct</a></span> parameter is set to <span class="RktVal">#t</span>, then
the way that <a href="structures.html#%28tech._structure%29" class="techoutside" data-pltdoc="x"><span class="techinside">structures</span></a> print depends on details of the structure type
for which the structure is an instance:</p><ul><li><p>If the structure type is a <a href="structures.html#%28tech._prefab%29" class="techoutside" data-pltdoc="x"><span class="techinside">prefab</span></a> structure type,
then it prints in <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._write%29%29" class="RktValLink" data-pltdoc="x">write</a></span> or <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._display%29%29" class="RktValLink" data-pltdoc="x">display</a></span> mode using
<span class="RktInBG"><span class="hspace"></span><span class="RktIn">#s(</span><span class="hspace"></span></span> followed by the <a href="structures.html#%28tech._prefab%29" class="techoutside" data-pltdoc="x"><span class="techinside">prefab</span></a> structure type key,
then the printed form of each field in the structure, and then
<span class="RktInBG"><span class="hspace"></span><span class="RktIn">)</span><span class="hspace"></span></span>.</p><p>In <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print%29%29" class="RktValLink" data-pltdoc="x">print</a></span> mode when <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print-as-expression%29%29" class="RktValLink" data-pltdoc="x">print-as-expression</a></span> is set
to <span class="RktVal">#t</span> and the current <a href="#%28tech._quoting._depth%29" class="techoutside" data-pltdoc="x"><span class="techinside">quoting depth</span></a> is
<span class="RktVal">0</span>, if the structure’s content is all <a href="#%28tech._quotable%29" class="techoutside" data-pltdoc="x"><span class="techinside">quotable</span></a>,
then the structure’s <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print%29%29" class="RktValLink" data-pltdoc="x">print</a></span>ed form is prefixed with
<span class="RktInBG"><span class="hspace"></span><span class="RktIn">'</span><span class="hspace"></span></span> and its content is printed with <a href="#%28tech._quoting._depth%29" class="techoutside" data-pltdoc="x"><span class="techinside">quoting
depth</span></a> <span class="RktVal">1</span>. If any of its content is not quotable, then
the structure type prints the same as a non-<a href="structures.html#%28tech._prefab%29" class="techoutside" data-pltdoc="x"><span class="techinside">prefab</span></a>
structure type.</p><p>An instance of a <a href="structures.html#%28tech._prefab%29" class="techoutside" data-pltdoc="x"><span class="techinside">prefab</span></a> structure type is <a href="#%28tech._quotable%29" class="techoutside" data-pltdoc="x"><span class="techinside">quotable</span></a>
when all of its content is <a href="#%28tech._quotable%29" class="techoutside" data-pltdoc="x"><span class="techinside">quotable</span></a>.</p></li><li><p>If the structure has a <span class="RktSym"><a href="Printer_Extension.html#%28def._%28%28quote._~23~25kernel%29._prop~3acustom-write%29%29" class="RktValLink" data-pltdoc="x">prop:custom-write</a></span> property
value, then the associated procedure is used to print the
structure, unless the <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print-unreadable%29%29" class="RktValLink" data-pltdoc="x">print-unreadable</a></span> parameter is
set to <span class="RktVal">#f</span>.</p><p>For <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print%29%29" class="RktValLink" data-pltdoc="x">print</a></span> mode, an instance of a structure type with a
<span class="RktSym"><a href="Printer_Extension.html#%28def._%28%28quote._~23~25kernel%29._prop~3acustom-write%29%29" class="RktValLink" data-pltdoc="x">prop:custom-write</a></span> property is treated as
<a href="#%28tech._quotable%29" class="techoutside" data-pltdoc="x"><span class="techinside">quotable</span></a> if it has the
<span class="RktSym"><a href="Printer_Extension.html#%28def._%28%28quote._~23~25kernel%29._prop~3acustom-print-quotable%29%29" class="RktValLink" data-pltdoc="x">prop:custom-print-quotable</a></span> property with a value of
<span class="RktVal">'</span><span class="RktVal">always</span>. If it has <span class="RktVal">'</span><span class="RktVal">maybe</span> as the property
value, then the structure is treated as <a href="#%28tech._quotable%29" class="techoutside" data-pltdoc="x"><span class="techinside">quotable</span></a> if its
content is <a href="#%28tech._quotable%29" class="techoutside" data-pltdoc="x"><span class="techinside">quotable</span></a>, where the content is determined by
the values recursively printed by the structure’s
<span class="RktSym"><a href="Printer_Extension.html#%28def._%28%28quote._~23~25kernel%29._prop~3acustom-write%29%29" class="RktValLink" data-pltdoc="x">prop:custom-write</a></span> procedure. Finally, if the structure
has <span class="RktVal">'</span><span class="RktVal">self</span> as the property value, then it is treated as
<a href="#%28tech._quotable%29" class="techoutside" data-pltdoc="x"><span class="techinside">quotable</span></a>.</p><p>In <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print%29%29" class="RktValLink" data-pltdoc="x">print</a></span> mode when <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print-as-expression%29%29" class="RktValLink" data-pltdoc="x">print-as-expression</a></span> is
<span class="RktVal">#t</span>, the structure’s <span class="RktSym"><a href="Printer_Extension.html#%28def._%28%28quote._~23~25kernel%29._prop~3acustom-write%29%29" class="RktValLink" data-pltdoc="x">prop:custom-write</a></span>
procedure is called with either <span class="RktVal">0</span> or <span class="RktVal">1</span> as the
<a href="#%28tech._quoting._depth%29" class="techoutside" data-pltdoc="x"><span class="techinside">quoting depth</span></a>, normally depending on the structure’s
<span class="RktSym"><a href="Printer_Extension.html#%28def._%28%28quote._~23~25kernel%29._prop~3acustom-print-quotable%29%29" class="RktValLink" data-pltdoc="x">prop:custom-print-quotable</a></span> property value. If the
property value is <span class="RktVal">'</span><span class="RktVal">always</span>, the <a href="#%28tech._quoting._depth%29" class="techoutside" data-pltdoc="x"><span class="techinside">quoting depth</span></a> is
normally <span class="RktVal">1</span>. If the property value is <span class="RktVal">'</span><span class="RktVal">maybe</span>,
then the <a href="#%28tech._quoting._depth%29" class="techoutside" data-pltdoc="x"><span class="techinside">quoting depth</span></a> is <span class="RktVal">1</span> if the structure is
<a href="#%28tech._quotable%29" class="techoutside" data-pltdoc="x"><span class="techinside">quotable</span></a>, or normally <span class="RktVal">0</span> otherwise. If the
property value is <span class="RktVal">'</span><span class="RktVal">self</span>, then the quoting depth may be
<span class="RktVal">0</span> or <span class="RktVal">1</span>; it is normally <span class="RktVal">0</span> if the
structure is not printed as a part of an enclosing
<a href="#%28tech._quotable%29" class="techoutside" data-pltdoc="x"><span class="techinside">quotable</span></a> value, even though the structure is treated as
<a href="#%28tech._quotable%29" class="techoutside" data-pltdoc="x"><span class="techinside">quotable</span></a>. Finally, if the property value is
<span class="RktVal">'</span><span class="RktVal">never</span>, then the <a href="#%28tech._quoting._depth%29" class="techoutside" data-pltdoc="x"><span class="techinside">quoting depth</span></a> is normally
<span class="RktVal">0</span>. The <a href="#%28tech._quoting._depth%29" class="techoutside" data-pltdoc="x"><span class="techinside">quoting depth</span></a> can vary from its normal
value if the structure is printed with an explicit quoting
depth of <span class="RktVal">1</span>.</p></li><li><p>If the structure’s type is transparent or if any ancestor is
transparent (i.e., <span class="RktSym"><a href="structutils.html#%28def._%28%28quote._~23~25kernel%29._struct~3f%29%29" class="RktValLink" data-pltdoc="x">struct?</a></span> on the instance produces
<span class="RktVal">#t</span>), then the structure prints as the vector produced
by <span class="RktSym"><a href="structutils.html#%28def._%28%28quote._~23~25kernel%29._struct-~3evector%29%29" class="RktValLink" data-pltdoc="x">struct->vector</a></span> in <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._display%29%29" class="RktValLink" data-pltdoc="x">display</a></span> mode, in
<span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._write%29%29" class="RktValLink" data-pltdoc="x">write</a></span> mode, or in <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print%29%29" class="RktValLink" data-pltdoc="x">print</a></span> mode when
<span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print-as-expression%29%29" class="RktValLink" data-pltdoc="x">print-as-expression</a></span> is set to <span class="RktVal">#f</span> or when the
<a href="#%28tech._quoting._depth%29" class="techoutside" data-pltdoc="x"><span class="techinside">quoting depth</span></a> is <span class="RktVal">0</span>.</p><p>In <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print%29%29" class="RktValLink" data-pltdoc="x">print</a></span> mode with <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print-as-expression%29%29" class="RktValLink" data-pltdoc="x">print-as-expression</a></span> as
<span class="RktVal">#t</span> and a <a href="#%28tech._quoting._depth%29" class="techoutside" data-pltdoc="x"><span class="techinside">quoting depth</span></a> of <span class="RktVal">0</span>, the
structure content is printed with a <span class="RktInBG"><span class="hspace"></span><span class="RktIn">(</span><span class="hspace"></span></span> followed by
the structure’s type name (as determined by
<span class="RktSym"><a href="inspectors.html#%28def._%28%28quote._~23~25kernel%29._object-name%29%29" class="RktValLink" data-pltdoc="x">object-name</a></span>) in <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._write%29%29" class="RktValLink" data-pltdoc="x">write</a></span> mode; the remaining
elements are <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print%29%29" class="RktValLink" data-pltdoc="x">print</a></span>ed at <a href="#%28tech._quoting._depth%29" class="techoutside" data-pltdoc="x"><span class="techinside">quoting depth</span></a>
<span class="RktVal">0</span> and separated by a space, and finally a closing
<span class="RktInBG"><span class="hspace"></span><span class="RktIn">)</span><span class="hspace"></span></span>.</p><p>A transparent structure type that is not a <a href="structures.html#%28tech._prefab%29" class="techoutside" data-pltdoc="x"><span class="techinside">prefab</span></a>
structure type is never <a href="#%28tech._quotable%29" class="techoutside" data-pltdoc="x"><span class="techinside">quotable</span></a>.</p></li><li><p>For any other structure type, the structure prints as an
unreadable value; see <a href="#%28part._print-unreadable%29" data-pltdoc="x">Printing Unreadable Values</a> for more
information.</p></li></ul><p>If the <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print-struct%29%29" class="RktValLink" data-pltdoc="x">print-struct</a></span> parameter is set to <span class="RktVal">#f</span>, then all
structures without a <span class="RktSym"><a href="Printer_Extension.html#%28def._%28%28quote._~23~25kernel%29._prop~3acustom-write%29%29" class="RktValLink" data-pltdoc="x">prop:custom-write</a></span> property print as
unreadable values (see <a href="#%28part._print-unreadable%29" data-pltdoc="x">Printing Unreadable Values</a>) and count as
<a href="#%28tech._quotable%29" class="techoutside" data-pltdoc="x"><span class="techinside">quotable</span></a>.</p><h5 x-source-module="(lib "scribblings/reference/reference.scrbl")" x-source-pkg="racket-doc" x-part-tag=""print-hashtable"">1.4.9<tt> </tt><a name="(part._print-hashtable)"></a>Printing Hash Tables</h5><p>When the <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print-hash-table%29%29" class="RktValLink" data-pltdoc="x">print-hash-table</a></span> parameter is set to <span class="RktVal">#t</span>, in
<span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._write%29%29" class="RktValLink" data-pltdoc="x">write</a></span> and <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._display%29%29" class="RktValLink" data-pltdoc="x">display</a></span> modes, a <a href="hashtables.html#%28tech._hash._table%29" class="techoutside" data-pltdoc="x"><span class="techinside">hash table</span></a> prints
starting with <span class="RktInBG"><span class="hspace"></span><span class="RktIn">#hash(</span><span class="hspace"></span></span>, <span class="RktInBG"><span class="hspace"></span><span class="RktIn">#hasheqv(</span><span class="hspace"></span></span>, or
<span class="RktInBG"><span class="hspace"></span><span class="RktIn">#hasheq(</span><span class="hspace"></span></span> for a table using <span class="RktSym"><a href="booleans.html#%28def._%28%28quote._~23~25kernel%29._equal~3f%29%29" class="RktValLink" data-pltdoc="x">equal?</a></span>, <span class="RktSym"><a href="booleans.html#%28def._%28%28quote._~23~25kernel%29._eqv~3f%29%29" class="RktValLink" data-pltdoc="x">eqv?</a></span>,
or <span class="RktSym"><a href="booleans.html#%28def._%28%28quote._~23~25kernel%29._eq~3f%29%29" class="RktValLink" data-pltdoc="x">eq?</a></span> key comparisons, respectively. After the prefix, each
key–value mapping is shown as <span class="RktInBG"><span class="hspace"></span><span class="RktIn">(</span><span class="hspace"></span></span>, the printed form of a key,
a space, <span class="RktInBG"><span class="hspace"></span><span class="RktIn">.</span><span class="hspace"></span></span>, a space, the printed form the corresponding
value, and <span class="RktInBG"><span class="hspace"></span><span class="RktIn">)</span><span class="hspace"></span></span>, with an additional space if the key–value
pair is not the last to be printed. After all key–value pairs, the
printed form completes with <span class="RktInBG"><span class="hspace"></span><span class="RktIn">)</span><span class="hspace"></span></span>.</p><p>In <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print%29%29" class="RktValLink" data-pltdoc="x">print</a></span> mode when <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print-as-expression%29%29" class="RktValLink" data-pltdoc="x">print-as-expression</a></span> is
<span class="RktVal">#f</span> or the <a href="#%28tech._quoting._depth%29" class="techoutside" data-pltdoc="x"><span class="techinside">quoting depth</span></a> is <span class="RktVal">1</span>, the printed form
is the same as for <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._write%29%29" class="RktValLink" data-pltdoc="x">write</a></span>. Otherwise, if the hash table’s keys
and values are all <a href="#%28tech._quotable%29" class="techoutside" data-pltdoc="x"><span class="techinside">quotable</span></a>, the table prints with a
<span class="RktInBG"><span class="hspace"></span><span class="RktIn">'</span><span class="hspace"></span></span> prefix, and the table’s key and values are <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print%29%29" class="RktValLink" data-pltdoc="x">print</a></span>ed
at <a href="#%28tech._quoting._depth%29" class="techoutside" data-pltdoc="x"><span class="techinside">quoting depth</span></a> <span class="RktVal">1</span>. If some key or value is not
<a href="#%28tech._quotable%29" class="techoutside" data-pltdoc="x"><span class="techinside">quotable</span></a>, the hash table prints as <span class="RktInBG"><span class="hspace"></span><span class="RktIn">(hash</span><span class="hspace"> </span></span>,
<span class="RktInBG"><span class="hspace"></span><span class="RktIn">(hasheqv</span><span class="hspace"> </span></span>, or <span class="RktInBG"><span class="hspace"></span><span class="RktIn">(hasheq</span><span class="hspace"> </span></span> followed by alternating
keys and values <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print%29%29" class="RktValLink" data-pltdoc="x">print</a></span>ed at <a href="#%28tech._quoting._depth%29" class="techoutside" data-pltdoc="x"><span class="techinside">quoting depth</span></a> <span class="RktVal">1</span> and
separated by spaces, and finally a closing <span class="RktInBG"><span class="hspace"></span><span class="RktIn">)</span><span class="hspace"></span></span>. A hash table
is <a href="#%28tech._quotable%29" class="techoutside" data-pltdoc="x"><span class="techinside">quotable</span></a> when all of its keys and values are
<a href="#%28tech._quotable%29" class="techoutside" data-pltdoc="x"><span class="techinside">quotable</span></a>.</p><p>When the <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print-hash-table%29%29" class="RktValLink" data-pltdoc="x">print-hash-table</a></span> parameter is set to <span class="RktVal">#f</span>, a
hash table prints as <span class="RktInBG"><span class="hspace"></span><span class="RktIn">#<hash></span><span class="hspace"></span></span> and counts as <a href="#%28tech._quotable%29" class="techoutside" data-pltdoc="x"><span class="techinside">quotable</span></a>.</p><h5 x-source-module="(lib "scribblings/reference/reference.scrbl")" x-source-pkg="racket-doc" x-part-tag=""print-box"">1.4.10<tt> </tt><a name="(part._print-box)"></a>Printing Boxes</h5><p>When the <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print-box%29%29" class="RktValLink" data-pltdoc="x">print-box</a></span> parameter is set to <span class="RktVal">#t</span>, a <a href="boxes.html#%28tech._box%29" class="techoutside" data-pltdoc="x"><span class="techinside">box</span></a>
prints as <span class="RktInBG"><span class="hspace"></span><span class="RktIn">#&</span><span class="hspace"></span></span> followed by the printed form of its content in
<span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._write%29%29" class="RktValLink" data-pltdoc="x">write</a></span>, <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._display%29%29" class="RktValLink" data-pltdoc="x">display</a></span>, or <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print%29%29" class="RktValLink" data-pltdoc="x">print</a></span> mode when
<span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print-as-expression%29%29" class="RktValLink" data-pltdoc="x">print-as-expression</a></span> is <span class="RktVal">#f</span> or the <a href="#%28tech._quoting._depth%29" class="techoutside" data-pltdoc="x"><span class="techinside">quoting
depth</span></a> is <span class="RktVal">1</span>.</p><p>In <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print%29%29" class="RktValLink" data-pltdoc="x">print</a></span> mode when <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print-as-expression%29%29" class="RktValLink" data-pltdoc="x">print-as-expression</a></span> is
<span class="RktVal">#t</span> and the <a href="#%28tech._quoting._depth%29" class="techoutside" data-pltdoc="x"><span class="techinside">quoting depth</span></a> is <span class="RktVal">0</span>, a box prints
with a <span class="RktInBG"><span class="hspace"></span><span class="RktIn">'</span><span class="hspace"></span></span> prefix and its value is printed at <a href="#%28tech._quoting._depth%29" class="techoutside" data-pltdoc="x"><span class="techinside">quoting
depth</span></a> <span class="RktVal">1</span> when its content is <a href="#%28tech._quotable%29" class="techoutside" data-pltdoc="x"><span class="techinside">quotable</span></a>, otherwise the
box prints a <span class="RktInBG"><span class="hspace"></span><span class="RktIn">(box</span><span class="hspace"> </span></span> followed by the content at
<a href="#%28tech._quoting._depth%29" class="techoutside" data-pltdoc="x"><span class="techinside">quoting depth</span></a> <span class="RktVal">0</span> and a closing <span class="RktInBG"><span class="hspace"></span><span class="RktIn">)</span><span class="hspace"></span></span>. A box is
<a href="#%28tech._quotable%29" class="techoutside" data-pltdoc="x"><span class="techinside">quotable</span></a> when its content is <a href="#%28tech._quotable%29" class="techoutside" data-pltdoc="x"><span class="techinside">quotable</span></a>.</p><p>When the <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print-box%29%29" class="RktValLink" data-pltdoc="x">print-box</a></span> parameter is set to <span class="RktVal">#f</span>, a box
prints as <span class="RktInBG"><span class="hspace"></span><span class="RktIn">#<box></span><span class="hspace"></span></span> and counts as <a href="#%28tech._quotable%29" class="techoutside" data-pltdoc="x"><span class="techinside">quotable</span></a>.</p><h5 x-source-module="(lib "scribblings/reference/reference.scrbl")" x-source-pkg="racket-doc" x-part-tag=""print-character"">1.4.11<tt> </tt><a name="(part._print-character)"></a>Printing Characters</h5><p><a href="characters.html#%28tech._character%29" class="techoutside" data-pltdoc="x"><span class="techinside">Characters</span></a> with the special names described in
<a href="reader.html#%28part._parse-character%29" data-pltdoc="x">Reading Characters</a> <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._write%29%29" class="RktValLink" data-pltdoc="x">write</a></span> and <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print%29%29" class="RktValLink" data-pltdoc="x">print</a></span> using the
same name. (Some characters have multiple names; the
<span class="RktVal">#\newline</span> and <span class="RktVal">#\nul</span> names are used instead of
<span class="RktVal">#\linefeed</span> and <span class="RktVal">#\null</span>.) Other graphic characters
(according to <span class="RktSym"><a href="characters.html#%28def._%28%28quote._~23~25kernel%29._char-graphic~3f%29%29" class="RktValLink" data-pltdoc="x">char-graphic?</a></span>) <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._write%29%29" class="RktValLink" data-pltdoc="x">write</a></span> as <span class="RktInBG"><span class="hspace"></span><span class="RktIn">#\</span><span class="hspace"></span></span>
followed by the single character, and all others characters are
written in <span class="RktVal">#\u</span> notation with four digits or <span class="RktVal">#\U</span>
notation with eight digits (using the latter only if the character
value does not fit in four digits).</p><p>All characters <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._display%29%29" class="RktValLink" data-pltdoc="x">display</a></span> directly as themselves (i.e., a single
character).</p><p>For the purposes of printing enclosing datatypes, a character is
<a href="#%28tech._quotable%29" class="techoutside" data-pltdoc="x"><span class="techinside">quotable</span></a>.</p><h5 x-source-module="(lib "scribblings/reference/reference.scrbl")" x-source-pkg="racket-doc" x-part-tag=""print-keyword"">1.4.12<tt> </tt><a name="(part._print-keyword)"></a>Printing Keywords</h5><p><a href="keywords.html#%28tech._keyword%29" class="techoutside" data-pltdoc="x"><span class="techinside">Keywords</span></a> <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._write%29%29" class="RktValLink" data-pltdoc="x">write</a></span>, <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print%29%29" class="RktValLink" data-pltdoc="x">print</a></span>, and <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._display%29%29" class="RktValLink" data-pltdoc="x">display</a></span> the same
as symbols (see <a href="#%28part._print-symbol%29" data-pltdoc="x">Printing Symbols</a>) except with a leading
<span class="RktInBG"><span class="hspace"></span><span class="RktIn">#:</span><span class="hspace"></span></span> (after any <span class="RktInBG"><span class="hspace"></span><span class="RktIn">'</span><span class="hspace"></span></span> prefix added in <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print%29%29" class="RktValLink" data-pltdoc="x">print</a></span>
mode), and without special handling for an initial <span class="RktInBG"><span class="hspace"></span><span class="RktIn">#</span><span class="hspace"></span></span> or when
the printed form would match a number or a delimited <span class="RktInBG"><span class="hspace"></span><span class="RktIn">.</span><span class="hspace"></span></span>
(since <span class="RktInBG"><span class="hspace"></span><span class="RktIn">#:</span><span class="hspace"></span></span> distinguishes the keyword).</p><p>For the purposes of printing enclosing datatypes, a keyword is
<a href="#%28tech._quotable%29" class="techoutside" data-pltdoc="x"><span class="techinside">quotable</span></a>.</p><h5 x-source-module="(lib "scribblings/reference/reference.scrbl")" x-source-pkg="racket-doc" x-part-tag=""print-regexp"">1.4.13<tt> </tt><a name="(part._print-regexp)"></a>Printing Regular Expressions</h5><p><a href="regexp.html#%28tech._regexp._value%29" class="techoutside" data-pltdoc="x"><span class="techinside">Regexp values</span></a> <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._write%29%29" class="RktValLink" data-pltdoc="x">write</a></span>, <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._display%29%29" class="RktValLink" data-pltdoc="x">display</a></span>, and <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print%29%29" class="RktValLink" data-pltdoc="x">print</a></span>
starting with <span class="RktInBG"><span class="hspace"></span><span class="RktIn">#px</span><span class="hspace"></span></span> (for <span class="RktSym"><a href="regexp.html#%28def._%28%28quote._~23~25kernel%29._pregexp%29%29" class="RktValLink" data-pltdoc="x">pregexp</a></span>-based regexps) or
<span class="RktInBG"><span class="hspace"></span><span class="RktIn">#rx</span><span class="hspace"></span></span> (for <span class="RktSym"><a href="regexp.html#%28def._%28%28quote._~23~25kernel%29._regexp%29%29" class="RktValLink" data-pltdoc="x">regexp</a></span>-based regexps) followed by the
<span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._write%29%29" class="RktValLink" data-pltdoc="x">write</a></span> form of the regexp’s source string or byte string.</p><p>For the purposes of printing enclosing datatypes, a regexp value is
<a href="#%28tech._quotable%29" class="techoutside" data-pltdoc="x"><span class="techinside">quotable</span></a>.</p><h5 x-source-module="(lib "scribblings/reference/reference.scrbl")" x-source-pkg="racket-doc" x-part-tag=""print-path"">1.4.14<tt> </tt><a name="(part._print-path)"></a>Printing Paths</h5><p><a href="pathutils.html#%28tech._path%29" class="techoutside" data-pltdoc="x"><span class="techinside">Paths</span></a> <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._write%29%29" class="RktValLink" data-pltdoc="x">write</a></span> and <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print%29%29" class="RktValLink" data-pltdoc="x">print</a></span> as <span class="RktInBG"><span class="hspace"></span><span class="RktIn">#<path:....></span><span class="hspace"></span></span>. A
path <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._display%29%29" class="RktValLink" data-pltdoc="x">display</a></span>s the same as the string produced by
<span class="RktSym"><a href="Manipulating_Paths.html#%28def._%28%28quote._~23~25kernel%29._path-~3estring%29%29" class="RktValLink" data-pltdoc="x">path->string</a></span>. For the purposes of printing enclosing
datatypes, a path counts as <a href="#%28tech._quotable%29" class="techoutside" data-pltdoc="x"><span class="techinside">quotable</span></a>.</p><p>Although a path can be converted to a string with
<span class="RktSym"><a href="Manipulating_Paths.html#%28def._%28%28quote._~23~25kernel%29._path-~3estring%29%29" class="RktValLink" data-pltdoc="x">path->string</a></span> or to a byte string with <span class="RktSym"><a href="Manipulating_Paths.html#%28def._%28%28quote._~23~25kernel%29._path-~3ebytes%29%29" class="RktValLink" data-pltdoc="x">path->bytes</a></span>,
neither is clearly the right choice for printing a path and reading it
back. If the path value is meant to be moved among platforms, then a
string is probably the right choice, despite the potential for losing
information when converting a path to a string. For a path that is
intended to be re-read on the same platform, a byte string is probably
the right choice, since it preserves information in an unportable
way. Paths do not print in a readable way so that programmers are not
misled into thinking that either choice is always appropriate.</p><h5 x-source-module="(lib "scribblings/reference/reference.scrbl")" x-source-pkg="racket-doc" x-part-tag=""print-unreadable"">1.4.15<tt> </tt><a name="(part._print-unreadable)"></a>Printing Unreadable Values</h5><p>For any value with no other printing specification, assuming that the
<span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print-unreadable%29%29" class="RktValLink" data-pltdoc="x">print-unreadable</a></span> parameter is set to <span class="RktVal">#t</span>, the output
form is <span class="RktInBG"><span class="hspace"></span><span class="RktIn">#<</span><span class="hspace"></span></span><span class="sroman">‹<span style="font-style: italic">something</span>›</span><span class="RktInBG"><span class="hspace"></span><span class="RktIn">></span><span class="hspace"></span></span>, where
<span class="sroman">‹<span style="font-style: italic">something</span>›</span> is specific to the type of the value and sometimes
to the value itself. If <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._print-unreadable%29%29" class="RktValLink" data-pltdoc="x">print-unreadable</a></span> is set to
<span class="RktVal">#f</span>, then attempting to print an unreadable value raises
<span class="RktSym"><a href="exns.html#%28def._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._exn~3afail%29%29" class="RktValLink" data-pltdoc="x">exn:fail</a></span>.</p><p>For the purposes of printing enclosing datatypes, a value that prints
unreadably nevertheless counts as <a href="#%28tech._quotable%29" class="techoutside" data-pltdoc="x"><span class="techinside">quotable</span></a>.</p><h5 x-source-module="(lib "scribblings/reference/reference.scrbl")" x-source-pkg="racket-doc" x-part-tag=""print-compiled"">1.4.16<tt> </tt><a name="(part._print-compiled)"></a>Printing Compiled Code</h5><p>Compiled code as produced by <span class="RktSym"><a href="eval.html#%28def._%28%28quote._~23~25kernel%29._compile%29%29" class="RktValLink" data-pltdoc="x">compile</a></span> prints using
<span class="RktInBG"><span class="hspace"></span><span class="RktIn">#~</span><span class="hspace"></span></span>. Compiled code printed with <span class="RktInBG"><span class="hspace"></span><span class="RktIn">#~</span><span class="hspace"></span></span> is essentially
assembly code for Racket, and reading such a form produces a compiled
form when the <span class="RktSym"><a href="Reading.html#%28def._%28%28quote._~23~25kernel%29._read-accept-compiled%29%29" class="RktValLink" data-pltdoc="x">read-accept-compiled</a></span> parameter is set to
<span class="RktVal">#t</span>.</p><p>When a compiled form contains syntax object constants, they must not
be <a href="stxcerts.html#%28tech._tainted%29" class="techoutside" data-pltdoc="x"><span class="techinside">tainted</span></a> or <a href="stxcerts.html#%28tech._armed%29" class="techoutside" data-pltdoc="x"><span class="techinside">armed</span></a>; the <span class="RktInBG"><span class="hspace"></span><span class="RktIn">#~</span><span class="hspace"></span></span>-marshaled form
drops source-location information and properties (see
<a href="stxprops.html" data-pltdoc="x">Syntax Object Properties</a>) for the <a href="syntax-model.html#%28tech._syntax._object%29" class="techoutside" data-pltdoc="x"><span class="techinside">syntax objects</span></a>.</p><p>Compiled code parsed from <span class="RktInBG"><span class="hspace"></span><span class="RktIn">#~</span><span class="hspace"></span></span> may contain references to
unexported or protected bindings from a module. At read time, such
references are associated with the current code inspector (see
<span class="RktSym"><a href="modprotect.html#%28def._%28%28quote._~23~25kernel%29._current-code-inspector%29%29" class="RktValLink" data-pltdoc="x">current-code-inspector</a></span>), and the code will only execute if
that inspector controls the relevant module invocation (see
<a href="modprotect.html" data-pltdoc="x">Code Inspectors</a>).</p><p>A compiled-form object may contain <a href="symbols.html#%28tech._uninterned%29" class="techoutside" data-pltdoc="x"><span class="techinside">uninterned</span></a> symbols (see
<a href="symbols.html" data-pltdoc="x">Symbols</a>) that were created by <span class="RktSym"><a href="symbols.html#%28def._%28%28quote._~23~25kernel%29._gensym%29%29" class="RktValLink" data-pltdoc="x">gensym</a></span> or
<span class="RktSym"><a href="symbols.html#%28def._%28%28quote._~23~25kernel%29._string-~3euninterned-symbol%29%29" class="RktValLink" data-pltdoc="x">string->uninterned-symbol</a></span>. When the compiled object is read
via <span class="RktInBG"><span class="hspace"></span><span class="RktIn">#~</span><span class="hspace"></span></span>, each uninterned symbol in the original form is
mapped to a new uninterned symbol, where multiple instances of a
single symbol are consistently mapped to the same new symbol. The
original and new symbols have the same printed
representation. <a href="symbols.html#%28tech._unreadable._symbol%29" class="techoutside" data-pltdoc="x"><span class="techinside">Unreadable symbols</span></a>, which are typically
generated indirectly during expansion and compilation, are saved and
restored consistently through <span class="RktInBG"><span class="hspace"></span><span class="RktIn">#~</span><span class="hspace"></span></span>.</p><p>The dynamic nature of <a href="symbols.html#%28tech._uninterned%29" class="techoutside" data-pltdoc="x"><span class="techinside">uninterned</span></a> symbols and their localization
within <span class="RktInBG"><span class="hspace"></span><span class="RktIn">#~</span><span class="hspace"></span></span> can cause problems when <span class="RktSym"><a href="symbols.html#%28def._%28%28quote._~23~25kernel%29._gensym%29%29" class="RktValLink" data-pltdoc="x">gensym</a></span> or
<span class="RktSym"><a href="symbols.html#%28def._%28%28quote._~23~25kernel%29._string-~3euninterned-symbol%29%29" class="RktValLink" data-pltdoc="x">string->uninterned-symbol</a></span> is used to construct an identifier
for a top-level or module binding (depending on how the identifier and
its references are compiled). To avoid problems, generate distinct
identifiers either with <span class="RktSym"><a href="stxops.html#%28def._%28%28lib._racket%2Fprivate%2Fstxcase-scheme..rkt%29._generate-temporaries%29%29" class="RktValLink" data-pltdoc="x">generate-temporaries</a></span> or by applying
the result of <span class="RktSym"><a href="stxtrans.html#%28def._%28%28quote._~23~25kernel%29._make-syntax-introducer%29%29" class="RktValLink" data-pltdoc="x">make-syntax-introducer</a></span> to an existing
identifier; those functions lead to top-level and module variables
with <a href="symbols.html#%28tech._unreadable._symbol%29" class="techoutside" data-pltdoc="x"><span class="techinside">unreadable symbol</span></a>ic names, and the names are deterministic
as long as expansion is otherwise deterministic.</p><p>Despite the problems inherent with <a href="symbols.html#%28tech._uninterned%29" class="techoutside" data-pltdoc="x"><span class="techinside">uninterned</span></a> symbols as
variable names, they are partially supported even across multiple
<span class="RktInBG"><span class="hspace"></span><span class="RktIn">#~</span><span class="hspace"></span></span>s: When compiled code contains a reference to a module-defined
variable whose name is an <a href="symbols.html#%28tech._uninterned%29" class="techoutside" data-pltdoc="x"><span class="techinside">uninterned</span></a> symbol, the relative
position of the variable among the module’s definitions is recorded,
and the reference can be linked back to the definition based on its
position and the characters in its name. This accommodation works only
for variable references in compiled code; it does not work for
<span class="RktSym"><a href="stx-patterns.html#%28form._%28%28lib._racket%2Fprivate%2Fstxcase-scheme..rkt%29._syntax%29%29" class="RktStxLink" data-pltdoc="x">syntax</a></span>-quoted identifiers, for example.</p><p>Finally, a compiled form may contain path literals. Although paths are
not normally printed in a way that can be read back in, path literals
can be written and read as part of compiled code. The
<span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._current-write-relative-directory%29%29" class="RktValLink" data-pltdoc="x">current-write-relative-directory</a></span> parameter is used to convert
the path to a relative path as is it written, and then
<span class="RktSym"><a href="eval.html#%28def._%28%28quote._~23~25kernel%29._current-load-relative-directory%29%29" class="RktValLink" data-pltdoc="x">current-load-relative-directory</a></span> parameter is used to convert
any relative path back as it is read. The relative-path conversion
applies on reading whether the path was originally relative or not.</p><div class="navsetbottom"><span class="navleft"><form class="searchform"><input class="searchbox" style="color: #888;" type="text" value="...search manuals..." title="Enter a search string to search the manuals" onkeypress="return DoSearchKey(event, this, "6.7", "../");" onfocus="this.style.color="black"; this.style.textAlign="left"; if (this.value == "...search manuals...") this.value="";" onblur="if (this.value.match(/^ *$/)) { this.style.color="#888"; this.style.textAlign="center"; this.value="...search manuals..."; }"/></form> <a href="../index.html" title="up to the documentation top" data-pltdoc="x" onclick="return GotoPLTRoot("6.7");">top</a></span><span class="navright"> <a href="reader.html" title="backward to "1.3 The Reader"" data-pltdoc="x">← prev</a> <a href="model.html" title="up to "1 Language Model"" data-pltdoc="x">up</a> <a href="notation.html" title="forward to "2 Notation for Documentation"" data-pltdoc="x">next →</a></span> </div></div></div><div id="contextindicator"> </div></body></html>
|