64 lines
3.9 KiB
HTML
64 lines
3.9 KiB
HTML
|
<!DOCTYPE HTML PUBLIC "-//W3O//DTD W3 HTML 2.0//EN">
|
||
|
<!Converted with LaTeX2HTML 0.6.5 (Tue Nov 15 1994) by Nikos Drakos (nikos@cbl.leeds.ac.uk), CBLU, University of Leeds >
|
||
|
<HEAD>
|
||
|
<TITLE> 1.2.2. Nil, False, and the Empty List</TITLE>
|
||
|
</HEAD>
|
||
|
<BODY>
|
||
|
<meta name="description" value=" Nil, False, and the Empty List">
|
||
|
<meta name="keywords" value="clm">
|
||
|
<meta name="resource-type" value="document">
|
||
|
<meta name="distribution" value="global">
|
||
|
<P>
|
||
|
<b>Common Lisp the Language, 2nd Edition</b>
|
||
|
<BR> <HR><A NAME=tex2html1596 HREF="node10.html"><IMG ALIGN=BOTTOM ALT="next" SRC="icons/next_motif.gif"></A> <A NAME=tex2html1594 HREF="node7.html"><IMG ALIGN=BOTTOM ALT="up" SRC="icons/up_motif.gif"></A> <A NAME=tex2html1588 HREF="node8.html"><IMG ALIGN=BOTTOM ALT="previous" SRC="icons/previous_motif.gif"></A> <A NAME=tex2html1598 HREF="node1.html"><IMG ALIGN=BOTTOM ALT="contents" SRC="icons/contents_motif.gif"></A> <A NAME=tex2html1599 HREF="index.html"><IMG ALIGN=BOTTOM ALT="index" SRC="icons/index_motif.gif"></A> <BR>
|
||
|
<B> Next:</B> <A NAME=tex2html1597 HREF="node10.html"> EvaluationExpansion, and </A>
|
||
|
<B>Up:</B> <A NAME=tex2html1595 HREF="node7.html"> Notational Conventions</A>
|
||
|
<B> Previous:</B> <A NAME=tex2html1589 HREF="node8.html"> Decimal Numbers</A>
|
||
|
<HR> <P>
|
||
|
<H2><A NAME=SECTION00522000000000000000> 1.2.2. Nil, False, and the Empty List</A></H2>
|
||
|
<P>
|
||
|
In Common Lisp, as in most Lisp dialects, the symbol <tt>nil</tt>
|
||
|
is used to represent both the empty list and the ``false'' value
|
||
|
for Boolean tests. An empty list may, of course, also be written
|
||
|
<tt>()</tt>; this normally denotes the same object as <tt>nil</tt>.
|
||
|
(It is possible, by extremely perverse manipulation of the package system,
|
||
|
to cause the sequence of letters <tt>nil</tt> to be recognized
|
||
|
not as the symbol that represents the empty list but as another
|
||
|
symbol with the same name. This obscure possibility will be ignored
|
||
|
in this book.)
|
||
|
These two notations may be used interchangeably as far as the Lisp
|
||
|
system is concerned. However, as a matter of style,
|
||
|
this book
|
||
|
uses the notation <tt>()</tt> when it is desirable to emphasize
|
||
|
the use of an empty list, and uses the notation <tt>nil</tt>
|
||
|
when it is desirable to emphasize the use of the Boolean ``false''.
|
||
|
The notation <tt>'nil</tt> (note the explicit quotation mark) is used to emphasize
|
||
|
the use of a symbol.
|
||
|
For example:
|
||
|
<P><pre>
|
||
|
(defun three () 3) ;Emphasize empty parameter list <BR>
|
||
|
(append '() '()) => () ;Emphasize use of empty lists <BR>
|
||
|
(not nil) => t ;Emphasize use as Boolean ``false'' <BR>
|
||
|
(get 'nil 'color) ;Emphasize use as a symbol
|
||
|
</pre><P>
|
||
|
<P>
|
||
|
Any data object other than <tt>nil</tt> is construed to be Boolean
|
||
|
``not false'', that is, ``true''. The symbol <tt>t</tt> is conventionally
|
||
|
used to mean ``true'' when no other value is more appropriate.
|
||
|
When a function is said to ``return <i>false</i>'' or to ``be <i>false</i>''
|
||
|
in some circumstance, this means that it returns <tt>nil</tt>.
|
||
|
However, when a function is said to ``return <i>true</i>'' or to ``be <i>true</i>''
|
||
|
in some circumstance, this means that it returns some value other
|
||
|
than <tt>nil</tt>, but not necessarily <tt>t</tt>.
|
||
|
<P>
|
||
|
<BR> <HR><A NAME=tex2html1596 HREF="node10.html"><IMG ALIGN=BOTTOM ALT="next" SRC="icons/next_motif.gif"></A> <A NAME=tex2html1594 HREF="node7.html"><IMG ALIGN=BOTTOM ALT="up" SRC="icons/up_motif.gif"></A> <A NAME=tex2html1588 HREF="node8.html"><IMG ALIGN=BOTTOM ALT="previous" SRC="icons/previous_motif.gif"></A> <A NAME=tex2html1598 HREF="node1.html"><IMG ALIGN=BOTTOM ALT="contents" SRC="icons/contents_motif.gif"></A> <A NAME=tex2html1599 HREF="index.html"><IMG ALIGN=BOTTOM ALT="index" SRC="icons/index_motif.gif"></A> <BR>
|
||
|
<B> Next:</B> <A NAME=tex2html1597 HREF="node10.html"> EvaluationExpansion, and </A>
|
||
|
<B>Up:</B> <A NAME=tex2html1595 HREF="node7.html"> Notational Conventions</A>
|
||
|
<B> Previous:</B> <A NAME=tex2html1589 HREF="node8.html"> Decimal Numbers</A>
|
||
|
<HR> <P>
|
||
|
<HR>
|
||
|
<P><ADDRESS>
|
||
|
AI.Repository@cs.cmu.edu
|
||
|
</ADDRESS>
|
||
|
</BODY>
|