1
0
Fork 0
cl-sites/HyperSpec-7-0/HyperSpec/Body/01_dac.htm
2024-04-01 10:24:07 +02:00

103 lines
8.3 KiB
HTML

<!-- Common Lisp HyperSpec (TM), version 7.0 generated by Kent M. Pitman on Mon, 11-Apr-2005 2:31am EDT -->
<HTML>
<HEAD>
<TITLE>CLHS: Section 1.4.1.3</TITLE>
<LINK HREF="../Data/clhs.css" REL="stylesheet" TYPE="text/css" />
<META HTTP-EQUIV="Author" CONTENT="Kent M. Pitman">
<META HTTP-EQUIV="Organization" CONTENT="LispWorks Ltd.">
<LINK REL=TOP HREF="../Front/index.htm">
<LINK REL=COPYRIGHT HREF="../Front/Help.htm#Legal">
<LINK REL=DISCLAIMER HREF="../Front/Help.htm#Disclaimer">
<LINK REL=PREV HREF="01_dabc.htm">
<LINK REL=UP HREF="01_da.htm">
<LINK REL=NEXT HREF="01_dad.htm">
</HEAD>
<BODY>
<H1><A REV=MADE HREF="http://www.lispworks.com/"><IMG WIDTH=80 HEIGHT=65 ALT="[LISPWORKS]" SRC="../Graphics/LWSmall.gif" ALIGN=Bottom></A><A REL=TOP HREF="../Front/index.htm"><IMG WIDTH=237 HEIGHT=65 ALT="[Common Lisp HyperSpec (TM)]" SRC="../Graphics/CLHS_Sm.gif" ALIGN=Bottom></A> <A REL=PREV HREF="01_dabc.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Previous]" SRC="../Graphics/Prev.gif" ALIGN=Bottom></A><A REL=UP HREF="01_da.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Up]" SRC="../Graphics/Up.gif" ALIGN=Bottom></A><A REL=NEXT HREF="01_dad.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Next]" SRC="../Graphics/Next.gif" ALIGN=Bottom></A></H1>
<HR>
<H2>
1.4.1.3 Special Symbols</H2> <P>
The special symbols described here are used as a notational convenience within this document, and are part of neither the Common Lisp language nor its environment. <P>
<P><DL><DT>=&gt; <P><DD>
This indicates evaluation. For example: <P>
<PRE>
(+ 4 5) =&gt; 9
</PRE>
</TT> This means that the result of evaluating the <A REL=DEFINITION HREF="26_glo_f.htm#form"><I>form</I></A> <TT>(+ 4 5)</TT> is <TT>9</TT>. <P>
If a <A REL=DEFINITION HREF="26_glo_f.htm#form"><I>form</I></A> returns <A REL=DEFINITION HREF="26_glo_m.htm#multiple_values"><I>multiple values</I></A>, those values might be shown separated by spaces, line breaks, or commas. For example: <P>
<PRE>
(truncate 7 5)
=&gt; 1 2
(truncate 7 5)
=&gt; 1
2
(truncate 7 5)
=&gt; 1, 2
</PRE>
</TT> <P>
Each of the above three examples is equivalent, and specifies that <TT>(truncate 7 5)</TT> returns two values, which are <TT>1</TT> and <TT>2</TT>. <P>
Some <A REL=DEFINITION HREF="26_glo_c.htm#conforming_implementation"><I>conforming implementations</I></A> actually type an arrow (or some other indicator) before showing return values, while others do not. <P>
<DT>OR=&gt; <P><DD>
The notation ``OR=&gt; '' is used to denote one of several possible alternate results. The example <P>
<PRE>
(char-name #\a)
=&gt; NIL
OR=&gt; &quot;LOWERCASE-a&quot;
OR=&gt; &quot;Small-A&quot;
OR=&gt; &quot;LA01&quot;
</PRE>
</TT> <P>
indicates that <A REL=DEFINITION HREF="a_nil.htm#nil"><B>nil</B></A>, <TT>&quot;LOWERCASE-a&quot;</TT>, <TT>&quot;Small-A&quot;</TT>, <TT>&quot;LA01&quot;</TT> are among the possible results of <TT>(char-name #\a)</TT>---each with equal preference. Unless explicitly specified otherwise, it should not be assumed that the set of possible results shown is exhaustive. Formally, the above example is equivalent to <P>
<PRE>
(char-name #\a) =&gt; <A REL=DEFINITION HREF="26_glo_i.htm#implementation-dependent">implementation-dependent</A>
</PRE>
</TT> <P>
but it is intended to provide additional information to illustrate some of the ways in which it is permitted for implementations to diverge. <P>
<DT>NOT=&gt; <P><DD>
The notation ``NOT=&gt; '' is used to denote a result which is not possible. This might be used, for example, in order to emphasize a situation where some anticipated misconception might lead the reader to falsely believe that the result might be possible. For example, <P>
<PRE>
(function-lambda-expression
(funcall #'(lambda (x) #'(lambda () x)) nil))
=&gt; NIL, <A REL=DEFINITION HREF="26_glo_t.htm#true">true</A>, NIL
OR=&gt; (LAMBDA () X), <A REL=DEFINITION HREF="26_glo_t.htm#true">true</A>, NIL
NOT=&gt; NIL, <A REL=DEFINITION HREF="26_glo_f.htm#false">false</A>, NIL
NOT=&gt; (LAMBDA () X), <A REL=DEFINITION HREF="26_glo_f.htm#false">false</A>, NIL
</PRE>
</TT> <P>
<DT>== <P><DD>
This indicates code equivalence. For example: <P>
<PRE>
(gcd x (gcd y z)) == (gcd (gcd x y) z)
</PRE>
</TT> This means that the results and observable side-effects of evaluating the <A REL=DEFINITION HREF="26_glo_f.htm#form"><I>form</I></A> <TT>(gcd x (gcd y z))</TT> are always the same as the results and observable side-effects of <TT>(gcd (gcd x y) z)</TT> for any <TT>x</TT>, <TT>y</TT>, and <TT>z</TT>. <P>
<DT>&gt;&gt; <P><DD>
Common Lisp specifies input and output with respect to a non-interactive stream model. The specific details of how interactive input and output are mapped onto that non-interactive model are <A REL=DEFINITION HREF="26_glo_i.htm#implementation-defined"><I>implementation-defined</I></A>. <P>
For example, <A REL=DEFINITION HREF="26_glo_c.htm#conforming_implementation"><I>conforming implementations</I></A> are permitted to differ in issues of how interactive input is terminated. For example, the <A REL=DEFINITION HREF="26_glo_f.htm#function"><I>function</I></A> <A REL=DEFINITION HREF="f_rd_rd.htm#read"><B>read</B></A> terminates when the final delimiter is typed on a non-interactive stream. In some <A REL=DEFINITION HREF="26_glo_i.htm#implementation"><I>implementations</I></A>, an interactive call to <A REL=DEFINITION HREF="f_rd_rd.htm#read"><B>read</B></A> returns as soon as the final delimiter is typed, even if that delimiter is not a <A REL=DEFINITION HREF="26_glo_n.htm#newline"><I>newline</I></A>. In other <A REL=DEFINITION HREF="26_glo_i.htm#implementation"><I>implementations</I></A>, a final <A REL=DEFINITION HREF="26_glo_n.htm#newline"><I>newline</I></A> is always required. In still other <A REL=DEFINITION HREF="26_glo_i.htm#implementation"><I>implementations</I></A>, there might be a command which ``activates'' a buffer full of input without the command itself being visible on the program's input stream. <P>
In the examples in this document, the notation ``&gt;&gt; '' precedes lines where interactive input and output occurs. Within such a scenario, ``this notation'' notates user input. <P>
For example, the notation <P>
<PRE>
(+ 1 (print (+ (sqrt (read)) (sqrt (read)))))
&gt;&gt; 9 16
&gt;&gt; 7
=&gt; 8
</PRE>
</TT> <P>
shows an interaction in which ``<TT>(+ 1 (print (+ (sqrt (read)) (sqrt (read)))))</TT>'' is a <A REL=DEFINITION HREF="26_glo_f.htm#form"><I>form</I></A> to be <I>evaluated</I>, ``<TT>9 16 </TT>'' is interactive input, ``<TT>7</TT>'' is interactive output, and ``<TT>8</TT>'' is the <A REL=DEFINITION HREF="26_glo_v.htm#value"><I>value</I></A> <I>yielded</I> from the <A REL=DEFINITION HREF="26_glo_e.htm#evaluation"><I>evaluation</I></A>. <P>
The use of this notation is intended to disguise small differences in interactive input and output behavior between <A REL=DEFINITION HREF="26_glo_i.htm#implementation"><I>implementations</I></A>. <P>
Sometimes, the non-interactive stream model calls for a <A REL=DEFINITION HREF="26_glo_n.htm#newline"><I>newline</I></A>. How that <A REL=DEFINITION HREF="26_glo_n.htm#newline"><I>newline</I></A> character is interactively entered is an <A REL=DEFINITION HREF="26_glo_i.htm#implementation-defined"><I>implementation-defined</I></A> detail of the user interface, but in that case, either the notation ``&lt;Newline&gt;'' or ``&lt;NEWLINE&gt;'' might be used. <P>
<PRE>
(progn (format t &quot;~&amp;Who? &quot;) (read-line))
&gt;&gt; Who? Fred, Mary, and Sally&lt;NEWLINE&gt;
=&gt; &quot;Fred, Mary, and Sally&quot;, <A REL=DEFINITION HREF="26_glo_f.htm#false">false</A>
</PRE>
</TT> <P>
<P></DL><P>
<HR>
<A REL=NAVIGATOR HREF="../Front/StartPts.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Starting Points]" SRC="../Graphics/StartPts.gif" ALIGN=Bottom></A><A REL=TOC HREF="../Front/Contents.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Contents]" SRC="../Graphics/Contents.gif" ALIGN=Bottom></A><A REL=INDEX HREF="../Front/X_Master.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Index]" SRC="../Graphics/Index.gif" ALIGN=Bottom></A><A REL=INDEX HREF="../Front/X_Symbol.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Symbols]" SRC="../Graphics/Symbols.gif" ALIGN=Bottom></A><A REL=GLOSSARY HREF="../Body/26_a.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Glossary]" SRC="../Graphics/Glossary.gif" ALIGN=Bottom></A><A HREF="../Front/X3J13Iss.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Issues]" SRC="../Graphics/Issues.gif" ALIGN=Bottom></A><BR>
<A REL=COPYRIGHT HREF="../Front/Help.htm#Legal"><I>Copyright 1996-2005, LispWorks Ltd. All rights reserved.</I></A><P>
</BODY>
</HTML>