Debian Codegraph @

info/gcl/pprint_002dpop.html

raw
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2 <html>
3 <!-- Created by GNU Texinfo 6.7, http://www.gnu.org/software/texinfo/ -->
4 <head>
5 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6 <title>pprint-pop (ANSI and GNU Common Lisp Document)</title>
7
8 <meta name="description" content="pprint-pop (ANSI and GNU Common Lisp Document)">
9 <meta name="keywords" content="pprint-pop (ANSI and GNU Common Lisp Document)">
10 <meta name="resource-type" content="document">
11 <meta name="distribution" content="global">
12 <meta name="Generator" content="makeinfo">
13 <link href="index.html" rel="start" title="Top">
14 <link href="Printer-Dictionary.html" rel="up" title="Printer Dictionary">
15 <link href="pprint_002dtab.html" rel="next" title="pprint-tab">
16 <link href="pprint_002dnewline.html" rel="prev" title="pprint-newline">
17 <style type="text/css">
18 <!--
19 a.summary-letter {text-decoration: none}
20 blockquote.indentedblock {margin-right: 0em}
21 div.display {margin-left: 3.2em}
22 div.example {margin-left: 3.2em}
23 div.lisp {margin-left: 3.2em}
24 kbd {font-style: oblique}
25 pre.display {font-family: inherit}
26 pre.format {font-family: inherit}
27 pre.menu-comment {font-family: serif}
28 pre.menu-preformatted {font-family: serif}
29 span.nolinebreak {white-space: nowrap}
30 span.roman {font-family: initial; font-weight: normal}
31 span.sansserif {font-family: sans-serif; font-weight: normal}
32 ul.no-bullet {list-style: none}
33 -->
34 </style>
35
36
37 </head>
38
39 <body lang="en">
40 <span id="pprint_002dpop"></span><div class="header">
41 <p>
42 Next: <a href="pprint_002dtab.html" accesskey="n" rel="next">pprint-tab</a>, Previous: <a href="pprint_002dnewline.html" accesskey="p" rel="prev">pprint-newline</a>, Up: <a href="Printer-Dictionary.html" accesskey="u" rel="up">Printer Dictionary</a> &nbsp; </p>
43 </div>
44 <hr>
45 <span id="pprint_002dpop-_005bLocal-Macro_005d"></span><h4 class="subsection">22.4.9 pprint-pop [Local Macro]</h4>
46
47 <span id="Syntax_003a_003a-38"></span><h4 class="subsubheading">Syntax::</h4>
48
49 <p><code>pprint-pop</code> <i>&lt;<i>no <i>arguments</i></i>&gt;</i> &rArr; <i>object</i>
50 </p>
51 <span id="Arguments-and-Values_003a_003a-462"></span><h4 class="subsubheading">Arguments and Values::</h4>
52
53 <p><i>object</i>&mdash;an <i>element</i> of the <i>list</i>
54 being printed in the <i>lexically current logical block</i>,
55 or <b>nil</b>.
56 </p>
57 <span id="Description_003a_003a-597"></span><h4 class="subsubheading">Description::</h4>
58
59 <p>Pops one <i>element</i> from the <i>list</i> being printed
60 in the <i>lexically current logical block</i>, obeying <b>*print-length*</b>
61 and <b>*print-circle*</b> as described below.
62 </p>
63 <p>Each time <b>pprint-pop</b> is called, it pops the next value off the
64 <i>list</i> passed to the <i>lexically current logical block</i> and returns it.
65 However, before doing this, it performs three tests:
66 </p>
67 <dl compact="compact">
68 <dt><tt>*</tt></dt>
69 <dd><p>If the remaining &lsquo;list&rsquo; is not a <i>list</i>,
70 &ldquo;<tt>. </tt>&rdquo; is printed followed by the remaining &lsquo;list.&rsquo;
71 (This makes it easier to write printing functions that
72 are robust in the face of malformed arguments.)
73 </p>
74 </dd>
75 <dt><tt>*</tt></dt>
76 <dd><p>If <b>*print-length*</b> is <i>non-nil</i>,
77 and <b>pprint-pop</b> has already been called <b>*print-length*</b> times
78 within the immediately containing logical block,
79 &ldquo;<tt>...</tt>&rdquo; is printed.
80 (This makes it easy to write printing functions that properly handle
81 <b>*print-length*</b>.)
82 </p>
83 </dd>
84 <dt><tt>*</tt></dt>
85 <dd><p>If <b>*print-circle*</b> is
86 <i>non-nil</i>, and the remaining list is a circular (or shared) reference,
87 then &ldquo;<tt>. </tt>&rdquo; is printed followed by an appropriate
88 &ldquo;<tt>#<i>n</i>#</tt>&rdquo; marker.
89 (This catches instances of <i>cdr</i> circularity and sharing in lists.)
90 </p></dd>
91 </dl>
92
93 <p>If either of the three conditions above occurs, the indicated output is
94 printed on the <i>pretty printing stream</i> created by the immediately containing
95 <b>pprint-logical-block</b> and the execution of the immediately containing
96 <b>pprint-logical-block</b> is terminated except for the printing of the suffix.
97 </p>
98 <p>If <b>pprint-logical-block</b> is given a &lsquo;list&rsquo; argument of <b>nil</b>&mdash;because
99 it is not processing a list&mdash;<b>pprint-pop</b> can still be used to obtain
100 support for <b>*print-length*</b>.
101 In this situation, the first and third tests above are disabled and
102 <b>pprint-pop</b> always returns <b>nil</b>.
103 See <a href="Examples-of-using-the-Pretty-Printer.html">Examples of using the Pretty Printer</a>&mdash;specifically, the <b>pprint-vector</b> example.
104 </p>
105 <p>Whether or not <b>pprint-pop</b> is <i>fbound</i> in the
106 <i>global environment</i> is <i>implementation-dependent</i>;
107 however, the restrictions on redefinition and <i>shadowing</i> of
108 <b>pprint-pop</b> are the same as for <i>symbols</i> in the <tt>COMMON-LISP</tt> <i>package</i>
109 which are <i>fbound</i> in the <i>global environment</i>.
110 The consequences of attempting to use <b>pprint-pop</b> outside
111 of <b>pprint-logical-block</b> are undefined.
112 </p>
113 <span id="Side-Effects_003a_003a-77"></span><h4 class="subsubheading">Side Effects::</h4>
114
115 <p>Might cause output
116 to the <i>pretty printing stream</i> associated with the lexically current logical block.
117 </p>
118 <span id="Affected-By_003a_003a-101"></span><h4 class="subsubheading">Affected By::</h4>
119
120 <p><b>*print-length*</b>, <b>*print-circle*</b>.
121 </p>
122 <span id="Exceptional-Situations_003a_003a-224"></span><h4 class="subsubheading">Exceptional Situations::</h4>
123
124 <p>An error is signaled (either at macro expansion time or at run time)
125 if a usage of <b>pprint-pop</b> occurs where there is no lexically
126 containing <b>pprint-logical-block</b> <i>form</i>.
127 </p>
128 <p>The consequences are undefined if <b>pprint-pop</b> is executed outside
129 of the <i>dynamic extent</i> of this <b>pprint-logical-block</b>.
130 </p>
131 <span id="See-Also_003a_003a-485"></span><h4 class="subsubheading">See Also::</h4>
132
133 <p><a href="pprint_002dexit_002dif_002dlist_002dexhausted.html">pprint-exit-if-list-exhausted</a>
134 ,
135 <a href="pprint_002dlogical_002dblock.html">pprint-logical-block</a>
136 .
137 </p>
138 <span id="Notes_003a_003a-301"></span><h4 class="subsubheading">Notes::</h4>
139
140 <p>It is frequently a good idea to call <b>pprint-exit-if-list-exhausted</b>
141 before calling <b>pprint-pop</b>.
142 </p>
143 <hr>
144 <div class="header">
145 <p>
146 Next: <a href="pprint_002dtab.html" accesskey="n" rel="next">pprint-tab</a>, Previous: <a href="pprint_002dnewline.html" accesskey="p" rel="prev">pprint-newline</a>, Up: <a href="Printer-Dictionary.html" accesskey="u" rel="up">Printer Dictionary</a> &nbsp; </p>
147 </div>
148
149
150
151 </body>
152 </html>