| 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.8, https://www.gnu.org/software/texinfo/ --> |
| 4 |
<head> |
| 5 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
| 6 |
<title>Iteration and Tests (GCL SI Manual)</title> |
| 7 |
|
| 8 |
<meta name="description" content="Iteration and Tests (GCL SI Manual)"> |
| 9 |
<meta name="keywords" content="Iteration and Tests (GCL SI Manual)"> |
| 10 |
<meta name="resource-type" content="document"> |
| 11 |
<meta name="distribution" content="global"> |
| 12 |
<meta name="Generator" content="makeinfo"> |
| •13 |
<meta name="viewport" content="width=device-width,initial-scale=1"> |
| 14 |
|
| 15 |
<link href="index.html" rel="start" title="Top"> |
| 16 |
<link href="Function-and-Variable-Index.html" rel="index" title="Function and Variable Index"> |
| •17 |
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents"> |
| 18 |
<link href="index.html" rel="up" title="Top"> |
| 19 |
<link href="User-Interface.html" rel="next" title="User Interface"> |
| 20 |
<link href="Structures.html" rel="prev" title="Structures"> |
| 21 |
<style type="text/css"> |
| 22 |
<!-- |
| •23 |
a.copiable-anchor {visibility: hidden; text-decoration: none; line-height: 0em} |
| 24 |
a.summary-letter {text-decoration: none} |
| 25 |
blockquote.indentedblock {margin-right: 0em} |
| 26 |
div.display {margin-left: 3.2em} |
| 27 |
div.example {margin-left: 3.2em} |
| 28 |
kbd {font-style: oblique} |
| 29 |
pre.display {font-family: inherit} |
| 30 |
pre.format {font-family: inherit} |
| 31 |
pre.menu-comment {font-family: serif} |
| 32 |
pre.menu-preformatted {font-family: serif} |
| 33 |
span.nolinebreak {white-space: nowrap} |
| 34 |
span.roman {font-family: initial; font-weight: normal} |
| 35 |
span.sansserif {font-family: sans-serif; font-weight: normal} |
| •36 |
span:hover a.copiable-anchor {visibility: visible} |
| 37 |
ul.no-bullet {list-style: none} |
| 38 |
--> |
| 39 |
</style> |
| 40 |
|
| 41 |
|
| 42 |
</head> |
| 43 |
|
| 44 |
<body lang="en"> |
| •45 |
<div class="chapter" id="Iteration-and-Tests"> |
| 46 |
<div class="header"> |
| 47 |
<p> |
| •48 |
Next: <a href="User-Interface.html" accesskey="n" rel="next">User Interface</a>, Previous: <a href="Structures.html" accesskey="p" rel="prev">Structures</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Function-and-Variable-Index.html" title="Index" rel="index">Index</a>]</p> |
| 49 |
</div> |
| 50 |
<hr> |
| 51 |
<span id="Iteration-and-Tests-1"></span><h2 class="chapter">11 Iteration and Tests</h2> |
| 52 |
|
| •53 |
<dl class="def"> |
| 54 |
<dt id="index-DO_002dEXTERNAL_002dSYMBOLS"><span class="category">Macro: </span><span><strong>DO-EXTERNAL-SYMBOLS</strong><a href='#index-DO_002dEXTERNAL_002dSYMBOLS' class='copiable-anchor'> ¶</a></span></dt> |
| 55 |
<dd><p>Package:LISP |
| 56 |
</p> |
| 57 |
<p>Syntax: |
| 58 |
</p><div class="example"> |
| 59 |
<pre class="example">(do-external-symbols (var [package [result-form]]) |
| 60 |
{decl}* {tag | statement}*) |
| 61 |
</pre></div> |
| 62 |
|
| 63 |
<p>Executes STATEMENTs once for each external symbol in the PACKAGE (which |
| 64 |
defaults to the current package), with VAR bound to the current symbol. |
| 65 |
Then evaluates RESULT-FORM (which defaults to NIL) and returns the value(s). |
| 66 |
</p> |
| 67 |
|
| 68 |
</dd></dl> |
| 69 |
|
| •70 |
<dl class="def"> |
| 71 |
<dt id="index-DO_002a"><span class="category">Special Form: </span><span><strong>DO*</strong><a href='#index-DO_002a' class='copiable-anchor'> ¶</a></span></dt> |
| 72 |
<dd><p>Package:LISP |
| 73 |
</p> |
| 74 |
<p>Syntax: |
| 75 |
</p><div class="example"> |
| 76 |
<pre class="example">(do* ({(var [init [step]])}*) (endtest {result}*) |
| 77 |
{decl}* {tag | statement}*) |
| 78 |
</pre></div> |
| 79 |
|
| 80 |
<p>Just like DO, but performs variable bindings and assignments in serial, just |
| 81 |
like LET* and SETQ do. |
| 82 |
</p> |
| 83 |
|
| 84 |
</dd></dl> |
| 85 |
|
| •86 |
<dl class="def"> |
| 87 |
<dt id="index-DO_002dALL_002dSYMBOLS"><span class="category">Macro: </span><span><strong>DO-ALL-SYMBOLS</strong><a href='#index-DO_002dALL_002dSYMBOLS' class='copiable-anchor'> ¶</a></span></dt> |
| 88 |
<dd><p>Package:LISP |
| 89 |
</p> |
| 90 |
<p>Syntax: |
| 91 |
</p><div class="example"> |
| 92 |
<pre class="example">(do-all-symbols (var [result-form]) {decl}* {tag | statement}*) |
| 93 |
</pre></div> |
| 94 |
|
| 95 |
<p>Executes STATEMENTs once for each symbol in each package, with VAR bound to |
| 96 |
the current symbol. Then evaluates RESULT-FORM (which defaults to NIL) and |
| 97 |
returns the value(s). |
| 98 |
</p> |
| 99 |
|
| 100 |
</dd></dl> |
| 101 |
|
| •102 |
<dl class="def"> |
| 103 |
<dt id="index-YES_002dOR_002dNO_002dP"><span class="category">Function: </span><span><strong>YES-OR-NO-P</strong> <em>(&optional (format-string nil) &rest args)</em><a href='#index-YES_002dOR_002dNO_002dP' class='copiable-anchor'> ¶</a></span></dt> |
| 104 |
<dd><p>Package:LISP |
| 105 |
</p> |
| 106 |
<p>Asks the user a question whose answer is either ’YES’ or ’NO’. If FORMAT- |
| 107 |
STRING is non-NIL, then FRESH-LINE operation is performed, a message is |
| 108 |
printed as if FORMAT-STRING and ARGs were given to FORMAT, and then a prompt |
| 109 |
"(Yes or No)" is printed. Otherwise, no prompt will appear. |
| 110 |
</p> |
| 111 |
|
| 112 |
</dd></dl> |
| 113 |
|
| •114 |
<dl class="def"> |
| 115 |
<dt id="index-MAPHASH"><span class="category">Function: </span><span><strong>MAPHASH</strong> <em>#'hash-table</em><a href='#index-MAPHASH' class='copiable-anchor'> ¶</a></span></dt> |
| 116 |
<dd><p>Package:LISP |
| 117 |
</p> |
| 118 |
<p>For each entry in HASH-TABLE, calls FUNCTION on the key and value of the |
| 119 |
entry; returns NIL. |
| 120 |
</p> |
| 121 |
|
| 122 |
</dd></dl> |
| 123 |
|
| •124 |
<dl class="def"> |
| 125 |
<dt id="index-MAPCAR"><span class="category">Function: </span><span><strong>MAPCAR</strong> <em>(fun list &rest more-lists)</em><a href='#index-MAPCAR' class='copiable-anchor'> ¶</a></span></dt> |
| 126 |
<dd><p>Package:LISP |
| 127 |
</p> |
| 128 |
<p>Applies FUN to successive cars of LISTs and returns the results as a list. |
| 129 |
</p> |
| 130 |
|
| 131 |
</dd></dl> |
| 132 |
|
| •133 |
<dl class="def"> |
| 134 |
<dt id="index-DOLIST"><span class="category">Special Form: </span><span><strong>DOLIST</strong><a href='#index-DOLIST' class='copiable-anchor'> ¶</a></span></dt> |
| 135 |
<dd><p>Package:LISP |
| 136 |
</p> |
| 137 |
<p>Syntax: |
| 138 |
</p><div class="example"> |
| 139 |
<pre class="example">(dolist (var listform [result]) {decl}* {tag | statement}*) |
| 140 |
</pre></div> |
| 141 |
|
| 142 |
<p>Executes STATEMENTs, with VAR bound to each member of the list value of |
| 143 |
LISTFORM. Then returns the value(s) of RESULT (which defaults to NIL). |
| 144 |
</p> |
| 145 |
|
| 146 |
</dd></dl> |
| 147 |
|
| •148 |
<dl class="def"> |
| 149 |
<dt id="index-EQ"><span class="category">Function: </span><span><strong>EQ</strong> <em>(x y)</em><a href='#index-EQ' class='copiable-anchor'> ¶</a></span></dt> |
| 150 |
<dd><p>Package:LISP |
| 151 |
</p> |
| 152 |
<p>Returns T if X and Y are the same identical object; NIL otherwise. |
| 153 |
</p> |
| 154 |
|
| 155 |
</dd></dl> |
| 156 |
|
| •157 |
<dl class="def"> |
| 158 |
<dt id="index-EQUALP"><span class="category">Function: </span><span><strong>EQUALP</strong> <em>(x y)</em><a href='#index-EQUALP' class='copiable-anchor'> ¶</a></span></dt> |
| 159 |
<dd><p>Package:LISP |
| 160 |
</p> |
| 161 |
<p>Returns T if X and Y are EQUAL, if they are characters and satisfy CHAR-EQUAL, |
| 162 |
if they are numbers and have the same numerical value, or if they have |
| 163 |
components that are all EQUALP. Returns NIL otherwise. |
| 164 |
</p> |
| 165 |
|
| 166 |
</dd></dl> |
| 167 |
|
| •168 |
<dl class="def"> |
| 169 |
<dt id="index-EQUAL"><span class="category">Function: </span><span><strong>EQUAL</strong> <em>(x y)</em><a href='#index-EQUAL' class='copiable-anchor'> ¶</a></span></dt> |
| 170 |
<dd><p>Package:LISP |
| 171 |
</p> |
| 172 |
<p>Returns T if X and Y are EQL or if they are of the same type and corresponding |
| 173 |
components are EQUAL. Returns NIL otherwise. Strings and bit-vectors are |
| 174 |
EQUAL if they are the same length and have identical components. Other |
| 175 |
arrays must be EQ to be EQUAL. |
| 176 |
</p> |
| 177 |
|
| 178 |
</dd></dl> |
| 179 |
|
| •180 |
<dl class="def"> |
| 181 |
<dt id="index-DO_002dSYMBOLS"><span class="category">Macro: </span><span><strong>DO-SYMBOLS</strong><a href='#index-DO_002dSYMBOLS' class='copiable-anchor'> ¶</a></span></dt> |
| 182 |
<dd><p>Package:LISP |
| 183 |
</p> |
| 184 |
<p>Syntax: |
| 185 |
</p><div class="example"> |
| 186 |
<pre class="example">(do-symbols (var [package [result-form]]) {decl}* {tag | |
| 187 |
statement}*) |
| 188 |
</pre></div> |
| 189 |
|
| 190 |
<p>Executes STATEMENTs once for each symbol in the PACKAGE (which defaults to |
| 191 |
the current package), with VAR bound to the current symbol. Then evaluates |
| 192 |
RESULT-FORM (which defaults to NIL) and returns the value(s). |
| 193 |
</p> |
| 194 |
|
| 195 |
</dd></dl> |
| 196 |
|
| •197 |
<dl class="def"> |
| 198 |
<dt id="index-LOOP"><span class="category">Special Form: </span><span><strong>LOOP</strong><a href='#index-LOOP' class='copiable-anchor'> ¶</a></span></dt> |
| 199 |
<dd><p>Package:LISP |
| 200 |
</p> |
| 201 |
<p>Syntax: |
| 202 |
</p><div class="example"> |
| 203 |
<pre class="example">(loop {form}*) |
| 204 |
</pre></div> |
| 205 |
|
| 206 |
<p>Executes FORMs repeatedly until exited by a THROW or RETURN. The FORMs are |
| 207 |
surrounded by an implicit NIL block. |
| 208 |
</p> |
| 209 |
|
| 210 |
</dd></dl> |
| 211 |
|
| •212 |
</div> |
| 213 |
<hr> |
| 214 |
<div class="header"> |
| 215 |
<p> |
| •216 |
Next: <a href="User-Interface.html">User Interface</a>, Previous: <a href="Structures.html">Structures</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Function-and-Variable-Index.html" title="Index" rel="index">Index</a>]</p> |
| 217 |
</div> |
| 218 |
|
| 219 |
|
| 220 |
|
| 221 |
</body> |
| 222 |
</html> |