blob: f4fdbba635a1eae8635c214a5e3c7480525318bc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
<h2 class="chapter">Sequences, Arrays, and Vectors</h2> <p>The <em>sequence</em> type is the union of two other Lisp types: lists and arrays. In other words, any list is a sequence, and any array is a sequence. The common property that all sequences have is that each is an ordered collection of elements. </p> <p>An <em>array</em> is a fixed-length object with a slot for each of its elements. All the elements are accessible in constant time. The four types of arrays are strings, vectors, char-tables and bool-vectors. </p> <p>A list is a sequence of elements, but it is not a single primitive object; it is made of cons cells, one cell per element. Finding the <var>n</var>th element requires looking through <var>n</var> cons cells, so elements farther from the beginning of the list take longer to access. But it is possible to add elements to the list, or remove elements. </p> <p>The following diagram shows the relationship between these types: </p> <div class="example"> <pre class="example"> _____________________________________________
| |
| Sequence |
| ______ ________________________________ |
| | | | | |
| | List | | Array | |
| | | | ________ ________ | |
| |______| | | | | | | |
| | | Vector | | String | | |
| | |________| |________| | |
| | ____________ _____________ | |
| | | | | | | |
| | | Char-table | | Bool-vector | | |
| | |____________| |_____________| | |
| |________________________________| |
|_____________________________________________|
</pre>
</div> <table class="menu" border="0" cellspacing="0"> <tr>
<td align="left" valign="top">• <a href="sequence-functions" accesskey="1">Sequence Functions</a>
</td>
<td> </td>
<td align="left" valign="top">Functions that accept any kind of sequence. </td>
</tr> <tr>
<td align="left" valign="top">• <a href="arrays" accesskey="2">Arrays</a>
</td>
<td> </td>
<td align="left" valign="top">Characteristics of arrays in Emacs Lisp. </td>
</tr> <tr>
<td align="left" valign="top">• <a href="array-functions" accesskey="3">Array Functions</a>
</td>
<td> </td>
<td align="left" valign="top">Functions specifically for arrays. </td>
</tr> <tr>
<td align="left" valign="top">• <a href="vectors" accesskey="4">Vectors</a>
</td>
<td> </td>
<td align="left" valign="top">Special characteristics of Emacs Lisp vectors. </td>
</tr> <tr>
<td align="left" valign="top">• <a href="vector-functions" accesskey="5">Vector Functions</a>
</td>
<td> </td>
<td align="left" valign="top">Functions specifically for vectors. </td>
</tr> <tr>
<td align="left" valign="top">• <a href="char_002dtables" accesskey="6">Char-Tables</a>
</td>
<td> </td>
<td align="left" valign="top">How to work with char-tables. </td>
</tr> <tr>
<td align="left" valign="top">• <a href="bool_002dvectors" accesskey="7">Bool-Vectors</a>
</td>
<td> </td>
<td align="left" valign="top">How to work with bool-vectors. </td>
</tr> <tr>
<td align="left" valign="top">• <a href="rings" accesskey="8">Rings</a>
</td>
<td> </td>
<td align="left" valign="top">Managing a fixed-size ring of objects. </td>
</tr> </table><div class="_attribution">
<p class="_attribution-p">
Copyright © 1990-1996, 1998-2022 Free Software Foundation, Inc. <br>Licensed under the GNU GPL license.<br>
<a href="https://www.gnu.org/software/emacs/manual/html_node/elisp/Sequences-Arrays-Vectors.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Sequences-Arrays-Vectors.html</a>
</p>
</div>
|