| 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>Conses as Lists (ANSI and GNU Common Lisp Document)</title> |
| 7 |
|
| 8 |
<meta name="description" content="Conses as Lists (ANSI and GNU Common Lisp Document)"> |
| 9 |
<meta name="keywords" content="Conses as Lists (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="Cons-Concepts.html" rel="up" title="Cons Concepts"> |
| 15 |
<link href="Lists-as-Association-Lists.html" rel="next" title="Lists as Association Lists"> |
| 16 |
<link href="General-Restrictions-on-Parameters-that-must-be-Trees.html" rel="prev" title="General Restrictions on Parameters that must be Trees"> |
| 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="Conses-as-Lists"></span><div class="header"> |
| 41 |
<p> |
| 42 |
Previous: <a href="Conses-as-Trees.html" accesskey="p" rel="prev">Conses as Trees</a>, Up: <a href="Cons-Concepts.html" accesskey="u" rel="up">Cons Concepts</a> </p> |
| 43 |
</div> |
| 44 |
<hr> |
| 45 |
<span id="Conses-as-Lists-1"></span><h4 class="subsection">14.1.2 Conses as Lists</h4> |
| 46 |
|
| 47 |
<p>A <i>list</i> |
| 48 |
<span id="index-list"></span> |
| 49 |
is a chain of <i>conses</i> in which the <i>car</i> of each |
| 50 |
<i>cons</i> is an <i>element</i> of the <i>list</i>, |
| 51 |
and the <i>cdr</i> of each <i>cons</i> is either the next |
| 52 |
link in the chain or a terminating <i>atom</i>. |
| 53 |
</p> |
| 54 |
<p>A <i>proper list</i> |
| 55 |
<span id="index-proper-list"></span> |
| 56 |
is a <i>list</i> terminated by the <i>empty list</i>. |
| 57 |
The <i>empty list</i> is a <i>proper list</i>, but is not a <i>cons</i>. |
| 58 |
</p> |
| 59 |
<p>An <i>improper list</i> |
| 60 |
<span id="index-improper-list"></span> |
| 61 |
is a <i>list</i> that is not a <i>proper list</i>; |
| 62 |
that is, it is a <i>circular list</i> or a <i>dotted list</i>. |
| 63 |
</p> |
| 64 |
<p>A <i>dotted list</i> |
| 65 |
<span id="index-dotted-list"></span> |
| 66 |
is a <i>list</i> that has a terminating <i>atom</i> |
| 67 |
that is not the <i>empty list</i>. A <i>non-nil</i> <i>atom</i> by itself |
| 68 |
is not considered to be a <i>list</i> of any kind—not even a <i>dotted list</i>. |
| 69 |
</p> |
| 70 |
<p>A <i>circular list</i> |
| 71 |
<span id="index-circular-list"></span> |
| 72 |
is a chain of <i>conses</i> that has no termination |
| 73 |
because some <i>cons</i> in the chain is the <i>cdr</i> of a later <i>cons</i>. |
| 74 |
</p> |
| 75 |
<div class="format"> |
| 76 |
<pre class="format"> append last nbutlast rest <!-- /@w --> |
| 77 |
butlast ldiff nconc revappend <!-- /@w --> |
| 78 |
copy-alist list ninth second <!-- /@w --> |
| 79 |
copy-list list* nreconc seventh <!-- /@w --> |
| 80 |
eighth list-length nth sixth <!-- /@w --> |
| 81 |
endp make-list nthcdr tailp <!-- /@w --> |
| 82 |
fifth member pop tenth <!-- /@w --> |
| 83 |
first member-if push third <!-- /@w --> |
| 84 |
fourth member-if-not pushnew <!-- /@w --> |
| 85 |
|
| 86 |
Figure 14–3: Some defined names relating to lists.<!-- /@w --> |
| 87 |
|
| 88 |
</pre></div> |
| 89 |
|
| 90 |
<table class="menu" border="0" cellspacing="0"> |
| 91 |
<tr><td align="left" valign="top">• <a href="Lists-as-Association-Lists.html" accesskey="1">Lists as Association Lists</a></td><td> </td><td align="left" valign="top"> |
| 92 |
</td></tr> |
| 93 |
<tr><td align="left" valign="top">• <a href="Lists-as-Sets.html" accesskey="2">Lists as Sets</a></td><td> </td><td align="left" valign="top"> |
| 94 |
</td></tr> |
| 95 |
<tr><td align="left" valign="top">• <a href="General-Restrictions-on-Parameters-that-must-be-Lists.html" accesskey="3">General Restrictions on Parameters that must be Lists</a></td><td> </td><td align="left" valign="top"> |
| 96 |
</td></tr> |
| 97 |
</table> |
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
|
| 102 |
</body> |
| 103 |
</html> |