| 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>Special Symbols (ANSI and GNU Common Lisp Document)</title> |
| 7 |
|
| 8 |
<meta name="description" content="Special Symbols (ANSI and GNU Common Lisp Document)"> |
| 9 |
<meta name="keywords" content="Special Symbols (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="Notational-Conventions.html" rel="up" title="Notational Conventions"> |
| 15 |
<link href="Objects-with-Multiple-Notations.html" rel="next" title="Objects with Multiple Notations"> |
| 16 |
<link href="Additional-Uses-for-Indirect-Definitions-in-Modified-BNF-Syntax.html" rel="prev" title="Additional Uses for Indirect Definitions in Modified BNF Syntax"> |
| 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="Special-Symbols"></span><div class="header"> |
| 41 |
<p> |
| 42 |
Next: <a href="Objects-with-Multiple-Notations.html" accesskey="n" rel="next">Objects with Multiple Notations</a>, Previous: <a href="Additional-Uses-for-Indirect-Definitions-in-Modified-BNF-Syntax.html" accesskey="p" rel="prev">Additional Uses for Indirect Definitions in Modified BNF Syntax</a>, Up: <a href="Notational-Conventions.html" accesskey="u" rel="up">Notational Conventions</a> </p> |
| 43 |
</div> |
| 44 |
<hr> |
| 45 |
<span id="Special-Symbols-1"></span><h4 class="subsubsection">1.4.1.6 Special Symbols</h4> |
| 46 |
|
| 47 |
<p>The special symbols described here are used as a notational convenience |
| 48 |
within this document, and are part of neither the <span class="roman">Common Lisp</span> language nor |
| 49 |
its environment. |
| 50 |
</p> |
| 51 |
<dl compact="compact"> |
| 52 |
<dt>⇒</dt> |
| 53 |
<dd><p>This indicates evaluation. |
| 54 |
For example: |
| 55 |
</p> |
| 56 |
<div class="example"> |
| 57 |
<pre class="example"> (+ 4 5) ⇒ 9 |
| 58 |
</pre></div> |
| 59 |
|
| 60 |
<p>This means that the result of |
| 61 |
evaluating the <i>form</i> <tt>(+ 4 5)</tt> is <tt>9</tt>. |
| 62 |
</p> |
| 63 |
<p>If a <i>form</i> returns <i>multiple values</i>, those values might |
| 64 |
be shown separated by spaces, line breaks, or commas. |
| 65 |
For example: |
| 66 |
</p> |
| 67 |
<div class="example"> |
| 68 |
<pre class="example"> (truncate 7 5) |
| 69 |
⇒ 1 2 |
| 70 |
(truncate 7 5) |
| 71 |
⇒ 1 |
| 72 |
2 |
| 73 |
(truncate 7 5) |
| 74 |
⇒ 1, 2 |
| 75 |
</pre></div> |
| 76 |
|
| 77 |
<p>Each of the above three examples is equivalent, and specifies |
| 78 |
that <tt>(truncate 7 5)</tt> returns two values, which are <tt>1</tt> and <tt>2</tt>. |
| 79 |
</p> |
| 80 |
<p>Some <i>conforming implementations</i> actually type an arrow (or some |
| 81 |
other indicator) before showing return values, while others do not. |
| 82 |
</p> |
| 83 |
</dd> |
| 84 |
<dt><i>OR</i>⇒</dt> |
| 85 |
<dd><p>The notation “<i>OR</i>⇒” is used to denote one of several possible |
| 86 |
alternate results. The example |
| 87 |
</p> |
| 88 |
<div class="example"> |
| 89 |
<pre class="example"> (char-name #\a) |
| 90 |
⇒ NIL |
| 91 |
<i>OR</i>⇒ "LOWERCASE-a" |
| 92 |
<i>OR</i>⇒ "Small-A" |
| 93 |
<i>OR</i>⇒ "LA01" |
| 94 |
</pre></div> |
| 95 |
|
| 96 |
<p>indicates that <b>nil</b>, <tt>"LOWERCASE-a"</tt>, <tt>"Small-A"</tt>, <tt>"LA01"</tt> are |
| 97 |
among the possible results of <tt>(char-name #\a)</tt>—each with equal preference. |
| 98 |
Unless explicitly specified otherwise, it should not be assumed that the set of possible |
| 99 |
results shown is exhaustive. |
| 100 |
Formally, the above example is equivalent to |
| 101 |
</p> |
| 102 |
<div class="example"> |
| 103 |
<pre class="example"> (char-name #\a) ⇒ <i>implementation-dependent</i> |
| 104 |
</pre></div> |
| 105 |
|
| 106 |
<p>but it is intended to provide additional information to illustrate some |
| 107 |
of the ways in which it is permitted for implementations to diverge. |
| 108 |
</p> |
| 109 |
</dd> |
| 110 |
<dt><i>NOT</i>⇒</dt> |
| 111 |
<dd><p>The notation “<i>NOT</i>⇒” is used to denote a result which is not possible. |
| 112 |
This might be used, for example, in order to emphasize a situation where |
| 113 |
some anticipated misconception might lead the reader to falsely believe |
| 114 |
that the result might be possible. For example, |
| 115 |
</p> |
| 116 |
<div class="example"> |
| 117 |
<pre class="example"> (function-lambda-expression |
| 118 |
(funcall #'(lambda (x) #'(lambda () x)) nil)) |
| 119 |
⇒ NIL, <i>true</i>, NIL |
| 120 |
<i>OR</i>⇒ (LAMBDA () X), <i>true</i>, NIL |
| 121 |
<i>NOT</i>⇒ NIL, <i>false</i>, NIL |
| 122 |
<i>NOT</i>⇒ (LAMBDA () X), <i>false</i>, NIL |
| 123 |
</pre></div> |
| 124 |
|
| 125 |
</dd> |
| 126 |
<dt>≡</dt> |
| 127 |
<dd><p>This indicates code equivalence. For example: |
| 128 |
</p> |
| 129 |
<div class="example"> |
| 130 |
<pre class="example"> (gcd x (gcd y z)) ≡ (gcd (gcd x y) z) |
| 131 |
</pre></div> |
| 132 |
|
| 133 |
<p>This means that the results and observable side-effects of evaluating |
| 134 |
the <i>form</i> |
| 135 |
<tt>(gcd x (gcd y z))</tt> are always the same as the results |
| 136 |
and observable side-effects of |
| 137 |
<tt>(gcd (gcd x y) z)</tt> for any |
| 138 |
<tt>x</tt>, <tt>y</tt>, and <tt>z</tt>. |
| 139 |
</p> |
| 140 |
</dd> |
| 141 |
<dt><tt> |> </tt></dt> |
| 142 |
<dd><p><span class="roman">Common Lisp</span> specifies input and output with respect to a non-interactive stream model. |
| 143 |
The specific details of how interactive input and output are mapped onto that |
| 144 |
non-interactive model are <i>implementation-defined</i>. |
| 145 |
</p> |
| 146 |
<p>For example, <i>conforming implementations</i> are permitted to differ in issues |
| 147 |
of how interactive input is terminated. For example, the <i>function</i> <b>read</b> |
| 148 |
terminates when the final delimiter is typed on a non-interactive stream. |
| 149 |
In some <i>implementations</i>, an interactive call to <b>read</b> returns |
| 150 |
as soon as the final delimiter is typed, even if that delimiter is not a <i>newline</i>. |
| 151 |
In other <i>implementations</i>, a final <i>newline</i> is always required. |
| 152 |
In still other <i>implementations</i>, there might be a command which “activates” |
| 153 |
a buffer full of input without the command itself being visible on the program’s |
| 154 |
input stream. |
| 155 |
</p> |
| 156 |
<p>In the examples in this document, the notation “<tt> |> </tt>” precedes |
| 157 |
lines where interactive input and output occurs. Within such a scenario, |
| 158 |
“<b>|>></b><tt>this notation</tt><b><<|</b>” notates user input. |
| 159 |
</p> |
| 160 |
<p>For example, the notation |
| 161 |
</p> |
| 162 |
<div class="example"> |
| 163 |
<pre class="example"> (+ 1 (print (+ (sqrt (read)) (sqrt (read))))) |
| 164 |
<tt> |> </tt> <b>|>></b><tt>9 16 </tt><b><<|</b> |
| 165 |
<tt> |> </tt> 7 |
| 166 |
⇒ 8 |
| 167 |
</pre></div> |
| 168 |
|
| 169 |
<p>shows an interaction in which |
| 170 |
“<tt>(+ 1 (print (+ (sqrt (read)) (sqrt (read)))))</tt>” |
| 171 |
is a <i>form</i> to be <i>evaluated</i>, |
| 172 |
“<tt>9 16 </tt>” is interactive input, |
| 173 |
“<tt>7</tt>” is interactive output, and |
| 174 |
“<tt>8</tt>” is the <i>value</i> <i>yielded</i> from the <i>evaluation</i>. |
| 175 |
</p> |
| 176 |
<p>The use of this notation is intended to disguise small differences |
| 177 |
in interactive input and output behavior between <i>implementations</i>. |
| 178 |
</p> |
| 179 |
<p>Sometimes, the non-interactive stream model calls for a <i>newline</i>. |
| 180 |
How that <i>newline</i> character is interactively entered is an |
| 181 |
<i>implementation-defined</i> detail of the user interface, but in that |
| 182 |
case, either the notation “<<i>Newline</i>>” or “<i>[<–</i>~]” might be used. |
| 183 |
</p> |
| 184 |
<div class="example"> |
| 185 |
<pre class="example"> (progn (format t "~&Who? ") (read-line)) |
| 186 |
<tt> |> </tt> Who? <b>|>></b><tt>Fred, Mary, and Sally <i>[<–</i>~]</tt><b><<|</b> |
| 187 |
⇒ "Fred, Mary, and Sally", <i>false</i> |
| 188 |
</pre></div> |
| 189 |
|
| 190 |
</dd> |
| 191 |
</dl> |
| 192 |
|
| 193 |
<hr> |
| 194 |
<div class="header"> |
| 195 |
<p> |
| 196 |
Next: <a href="Objects-with-Multiple-Notations.html" accesskey="n" rel="next">Objects with Multiple Notations</a>, Previous: <a href="Additional-Uses-for-Indirect-Definitions-in-Modified-BNF-Syntax.html" accesskey="p" rel="prev">Additional Uses for Indirect Definitions in Modified BNF Syntax</a>, Up: <a href="Notational-Conventions.html" accesskey="u" rel="up">Notational Conventions</a> </p> |
| 197 |
</div> |
| 198 |
|
| 199 |
|
| 200 |
|
| 201 |
</body> |
| 202 |
</html> |