comparison man/lispref/lists.texi @ 5583:10f179710250

Deprecate #'remassoc, #'remassq, #'remrassoc, #'remrassq. src/ChangeLog addition: 2011-10-09 Aidan Kehoe <kehoea@parhasard.net> * fns.c (remassoc_no_quit): * fns.c (remrassq_no_quit): * fns.c (syms_of_fns): * fontcolor-tty.c (Fregister_tty_color): * fontcolor-tty.c (Funregister_tty_color): * fontcolor-tty.c (Ffind_tty_color): * lisp.h: Remove Fremassq, Fremrassq, Fremassoc, Fremrassoc, they're XEmacs-specific functions and Lisp callers should use (delete* ... :key #'car) anyway. Keep the non-Lisp-visible _no_quit versions, calling FdeleteX from C with the appropriate arguments is ungainly. lisp/ChangeLog addition: 2011-10-09 Aidan Kehoe <kehoea@parhasard.net> * obsolete.el: * obsolete.el (assq-delete-all): * packages.el (package-provide): * packages.el (package-suppress): * mule/cyrillic.el ("Cyrillic-KOI8"): * mule/cyrillic.el (koi8-u): * mule/general-late.el (posix-charset-to-coding-system-hash): * mule/latin.el: * mule/latin.el (for): * cl-extra.el: * cl-extra.el (cl-extra): * loadup.el (load-history): Change any uses of #'remassq, #'remassoc and friends to calling #'delete* with an appropriate key argument. Provide compatibility implementations, mark them obsolete. man/ChangeLog addition: 2011-10-09 Aidan Kehoe <kehoea@parhasard.net> * lispref/lists.texi (Association Lists): Don't document #'remassoc, #'remassq and friends in detail; they're XEmacs-specific and (delete* ... :key #'car) is preferable.
author Aidan Kehoe <kehoea@parhasard.net>
date Sun, 09 Oct 2011 12:55:51 +0100
parents 62b9ef1ed4ac
children 9fae6227ede5
comparison
equal deleted inserted replaced
5582:873d7425c1ad 5583:10f179710250
1449 is more than one. 1449 is more than one.
1450 1450
1451 In XEmacs Lisp, it is @emph{not} an error if an element of an 1451 In XEmacs Lisp, it is @emph{not} an error if an element of an
1452 association list is not a cons cell. The alist search functions simply 1452 association list is not a cons cell. The alist search functions simply
1453 ignore such elements. Many other versions of Lisp signal errors in such 1453 ignore such elements. Many other versions of Lisp signal errors in such
1454 cases. 1454 cases, and it is good practice to avoid adding non-cons-cells to association
1455 lists.
1455 1456
1456 Note that property lists are similar to association lists in several 1457 Note that property lists are similar to association lists in several
1457 respects. A property list behaves like an association list in which 1458 respects. A property list behaves like an association list in which
1458 each key can occur only once. @xref{Property Lists}, for a comparison 1459 each key can occur only once. @xref{Property Lists}, for a comparison
1459 of property lists and association lists. 1460 of property lists and association lists.
1567 @smallexample 1568 @smallexample
1568 (lily white) @equiv{} (lily . (white)) 1569 (lily white) @equiv{} (lily . (white))
1569 @end smallexample 1570 @end smallexample
1570 @end defun 1571 @end defun
1571 1572
1572 @defun remassoc key alist
1573 This function deletes by side effect any associations with key @var{key}
1574 in @var{alist}---i.e. it removes any elements from @var{alist} whose
1575 @code{car} is @code{equal} to @var{key}. The modified @var{alist} is
1576 returned.
1577
1578 If the first member of @var{alist} has a @code{car} that is @code{equal}
1579 to @var{key}, there is no way to remove it by side effect; therefore,
1580 write @code{(setq foo (remassoc key foo))} to be sure of changing the
1581 value of @code{foo}.
1582 @end defun
1583
1584 @defun remassq key alist
1585 This function deletes by side effect any associations with key @var{key}
1586 in @var{alist}---i.e. it removes any elements from @var{alist} whose
1587 @code{car} is @code{eq} to @var{key}. The modified @var{alist} is
1588 returned.
1589
1590 This function is exactly like @code{remassoc}, but comparisons between
1591 @var{key} and keys in @var{alist} are done using @code{eq} instead of
1592 @code{equal}.
1593 @end defun
1594
1595 @defun remrassoc value alist
1596 This function deletes by side effect any associations with value @var{value}
1597 in @var{alist}---i.e. it removes any elements from @var{alist} whose
1598 @code{cdr} is @code{equal} to @var{value}. The modified @var{alist} is
1599 returned.
1600
1601 If the first member of @var{alist} has a @code{car} that is @code{equal}
1602 to @var{value}, there is no way to remove it by side effect; therefore,
1603 write @code{(setq foo (remassoc value foo))} to be sure of changing the
1604 value of @code{foo}.
1605
1606 @code{remrassoc} is like @code{remassoc} except that it compares the
1607 @sc{cdr} of each @var{alist} association instead of the @sc{car}. You
1608 can think of this as ``reverse @code{remassoc}'', removing an association
1609 based on its value instead of its key.
1610 @end defun
1611
1612 @defun remrassq value alist
1613 This function deletes by side effect any associations with value @var{value}
1614 in @var{alist}---i.e. it removes any elements from @var{alist} whose
1615 @code{cdr} is @code{eq} to @var{value}. The modified @var{alist} is
1616 returned.
1617
1618 This function is exactly like @code{remrassoc}, but comparisons between
1619 @var{value} and values in @var{alist} are done using @code{eq} instead of
1620 @code{equal}.
1621 @end defun
1622
1623 @defun copy-alist alist 1573 @defun copy-alist alist
1624 @cindex copying alists 1574 @cindex copying alists
1625 This function returns a two-level deep copy of @var{alist}: it creates a 1575 This function returns a two-level deep copy of @var{alist}: it creates a
1626 new copy of each association, so that you can alter the associations of 1576 new copy of each association, so that you can alter the associations of
1627 the new alist without changing the old one. 1577 the new alist without changing the old one.
1669 @result{} ("Pitch Pine") 1619 @result{} ("Pitch Pine")
1670 @end group 1620 @end group
1671 @end smallexample 1621 @end smallexample
1672 @end defun 1622 @end defun
1673 1623
1624 For removing elements from alists, use @code{remove*} or @code{delete*} with
1625 appropriate @code{:key} arguments. If it is necessary that XEmacs not error
1626 on encountering a non-cons in such a list, there are XEmacs-specific functions
1627 @code{remassq}, @code{remrassq}, @code{remassoc}, and @code{remrassoc} with
1628 this behavior, but they are neither available under GNU Emacs nor Common Lisp.
1629 They are marked as obsolete, and it is preferable to fix your code to avoid
1630 adding non-cons objects to alists.
1631
1674 @node Property Lists 1632 @node Property Lists
1675 @section Property Lists 1633 @section Property Lists
1676 @cindex property list 1634 @cindex property list
1677 @cindex plist 1635 @cindex plist
1678 1636