summaryrefslogtreecommitdiff
path: root/devdocs/elisp/modifying-lists.html
diff options
context:
space:
mode:
Diffstat (limited to 'devdocs/elisp/modifying-lists.html')
-rw-r--r--devdocs/elisp/modifying-lists.html22
1 files changed, 22 insertions, 0 deletions
diff --git a/devdocs/elisp/modifying-lists.html b/devdocs/elisp/modifying-lists.html
new file mode 100644
index 00000000..b2eae408
--- /dev/null
+++ b/devdocs/elisp/modifying-lists.html
@@ -0,0 +1,22 @@
+ <h3 class="section">Modifying Existing List Structure</h3> <p>You can modify the <small>CAR</small> and <small>CDR</small> contents of a cons cell with the primitives <code>setcar</code> and <code>setcdr</code>. These are destructive operations because they change existing list structure. Destructive operations should be applied only to mutable lists, that is, lists constructed via <code>cons</code>, <code>list</code> or similar operations. Lists created by quoting are part of the program and should not be changed by destructive operations. See <a href="mutability">Mutability</a>. </p> <blockquote> <p><b>Common Lisp note:</b> Common Lisp uses functions <code>rplaca</code> and <code>rplacd</code> to alter list structure; they change structure the same way as <code>setcar</code> and <code>setcdr</code>, but the Common Lisp functions return the cons cell while <code>setcar</code> and <code>setcdr</code> return the new <small>CAR</small> or <small>CDR</small>. </p>
+</blockquote> <table class="menu" border="0" cellspacing="0"> <tr>
+<td align="left" valign="top">• <a href="setcar" accesskey="1">Setcar</a>
+</td>
+<td> </td>
+<td align="left" valign="top">Replacing an element in a list. </td>
+</tr> <tr>
+<td align="left" valign="top">• <a href="setcdr" accesskey="2">Setcdr</a>
+</td>
+<td> </td>
+<td align="left" valign="top">Replacing part of the list backbone. This can be used to remove or add elements. </td>
+</tr> <tr>
+<td align="left" valign="top">• <a href="rearrangement" accesskey="3">Rearrangement</a>
+</td>
+<td> </td>
+<td align="left" valign="top">Reordering the elements in a list; combining lists. </td>
+</tr> </table><div class="_attribution">
+ <p class="_attribution-p">
+ Copyright &copy; 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/Modifying-Lists.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Modifying-Lists.html</a>
+ </p>
+</div>