diff options
| author | Chong Yidong | 2012-09-09 15:50:45 +0800 |
|---|---|---|
| committer | Chong Yidong | 2012-09-09 15:50:45 +0800 |
| commit | bb6b0efc3490a1e47e69e3afbc115576025f3606 (patch) | |
| tree | 66be2649d18edba64b853204777666d73da44091 | |
| parent | e4e55af11e05361f7573a5c7fc16189affe5b08b (diff) | |
| download | emacs-bb6b0efc3490a1e47e69e3afbc115576025f3606.tar.gz emacs-bb6b0efc3490a1e47e69e3afbc115576025f3606.zip | |
Clarify descriptions of delq and delete in Lisp manual.
* doc/lispref/lists.texi (Sets And Lists): Explain that the return value for
delete should be used, like for delq.
| -rw-r--r-- | doc/lispref/ChangeLog | 3 | ||||
| -rw-r--r-- | doc/lispref/lists.texi | 33 |
2 files changed, 24 insertions, 12 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index 79691bfb181..ceb199dae88 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog | |||
| @@ -1,5 +1,8 @@ | |||
| 1 | 2012-09-09 Chong Yidong <cyd@gnu.org> | 1 | 2012-09-09 Chong Yidong <cyd@gnu.org> |
| 2 | 2 | ||
| 3 | * lists.texi (Sets And Lists): Explain that the return value for | ||
| 4 | delete should be used, like for delq. | ||
| 5 | |||
| 3 | * minibuf.texi (Yes-or-No Queries): Document recentering and | 6 | * minibuf.texi (Yes-or-No Queries): Document recentering and |
| 4 | scrolling in y-or-n-p. Remove gratuitous example. | 7 | scrolling in y-or-n-p. Remove gratuitous example. |
| 5 | 8 | ||
diff --git a/doc/lispref/lists.texi b/doc/lispref/lists.texi index 023f8ba18dd..d685ce0aa74 100644 --- a/doc/lispref/lists.texi +++ b/doc/lispref/lists.texi | |||
| @@ -1293,14 +1293,19 @@ compare @var{object} against the elements of the list. For example: | |||
| 1293 | @defun delq object list | 1293 | @defun delq object list |
| 1294 | @cindex deleting list elements | 1294 | @cindex deleting list elements |
| 1295 | This function destructively removes all elements @code{eq} to | 1295 | This function destructively removes all elements @code{eq} to |
| 1296 | @var{object} from @var{list}. The letter @samp{q} in @code{delq} says | 1296 | @var{object} from @var{list}, and returns the resulting list. The |
| 1297 | that it uses @code{eq} to compare @var{object} against the elements of | 1297 | letter @samp{q} in @code{delq} says that it uses @code{eq} to compare |
| 1298 | the list, like @code{memq} and @code{remq}. | 1298 | @var{object} against the elements of the list, like @code{memq} and |
| 1299 | @code{remq}. | ||
| 1300 | |||
| 1301 | Typically, when you invoke @code{delq}, you should use the return | ||
| 1302 | value by assigning it to the variable which held the original list. | ||
| 1303 | The reason for this is explained below. | ||
| 1299 | @end defun | 1304 | @end defun |
| 1300 | 1305 | ||
| 1301 | When @code{delq} deletes elements from the front of the list, it does so | 1306 | The @code{delq} function deletes elements from the front of the list |
| 1302 | simply by advancing down the list and returning a sublist that starts | 1307 | by simply advancing down the list, and returning a sublist that starts |
| 1303 | after those elements: | 1308 | after those elements. For example: |
| 1304 | 1309 | ||
| 1305 | @example | 1310 | @example |
| 1306 | @group | 1311 | @group |
| @@ -1308,6 +1313,7 @@ after those elements: | |||
| 1308 | @end group | 1313 | @end group |
| 1309 | @end example | 1314 | @end example |
| 1310 | 1315 | ||
| 1316 | @noindent | ||
| 1311 | When an element to be deleted appears in the middle of the list, | 1317 | When an element to be deleted appears in the middle of the list, |
| 1312 | removing it involves changing the @sc{cdr}s (@pxref{Setcdr}). | 1318 | removing it involves changing the @sc{cdr}s (@pxref{Setcdr}). |
| 1313 | 1319 | ||
| @@ -1432,12 +1438,15 @@ Compare this with @code{memq}: | |||
| 1432 | @end defun | 1438 | @end defun |
| 1433 | 1439 | ||
| 1434 | @defun delete object sequence | 1440 | @defun delete object sequence |
| 1435 | If @code{sequence} is a list, this function destructively removes all | 1441 | This function removes all elements @code{equal} to @var{object} from |
| 1436 | elements @code{equal} to @var{object} from @var{sequence}. For lists, | 1442 | @var{sequence}, and returns the resulting sequence. |
| 1437 | @code{delete} is to @code{delq} as @code{member} is to @code{memq}: it | 1443 | |
| 1438 | uses @code{equal} to compare elements with @var{object}, like | 1444 | If @var{sequence} is a list, @code{delete} is to @code{delq} as |
| 1439 | @code{member}; when it finds an element that matches, it cuts the | 1445 | @code{member} is to @code{memq}: it uses @code{equal} to compare |
| 1440 | element out just as @code{delq} would. | 1446 | elements with @var{object}, like @code{member}; when it finds an |
| 1447 | element that matches, it cuts the element out just as @code{delq} | ||
| 1448 | would. As with @code{delq}, you should typically use the return value | ||
| 1449 | by assigning it to the variable which held the original list. | ||
| 1441 | 1450 | ||
| 1442 | If @code{sequence} is a vector or string, @code{delete} returns a copy | 1451 | If @code{sequence} is a vector or string, @code{delete} returns a copy |
| 1443 | of @code{sequence} with all elements @code{equal} to @code{object} | 1452 | of @code{sequence} with all elements @code{equal} to @code{object} |