909 |
position specified by @var{order}. If @var{element} is already a |
position specified by @var{order}. If @var{element} is already a |
910 |
member of the list, its position in the list is adjusted according |
member of the list, its position in the list is adjusted according |
911 |
to @var{order}. Membership is tested using @code{eq}. |
to @var{order}. Membership is tested using @code{eq}. |
912 |
The valued returned is the resulting list, whether updated or not. |
This function returns the resulting list, whether updated or not. |
913 |
|
|
914 |
The @var{order} is a number, and the elements on list are sorted in |
The @var{order} is typically a number (integer or float), and the |
915 |
increasing numerical order. Elements without a numeric list order are |
elements of the list are sorted in non-decreasing numerical order. |
916 |
placed at the end of @var{symbol}. |
|
917 |
|
@var{order} may also be omitted or @code{nil}. Then the numeric order |
918 |
|
of @var{element} stays unchanged if it already has one; otherwise, |
919 |
|
@var{element} has no numeric order. Elements without a numeric list |
920 |
|
order are placed at the end of the list, in no particular order. |
921 |
|
|
922 |
|
Any other value for @var{order} removes the numeric order of @var{element} |
923 |
|
if it already has one; otherwise, it is equivalent to @code{nil}. |
924 |
|
|
925 |
The argument @var{symbol} is not implicitly quoted; |
The argument @var{symbol} is not implicitly quoted; |
926 |
@code{add-to-ordered-list} is an ordinary function, like @code{set} |
@code{add-to-ordered-list} is an ordinary function, like @code{set} |
927 |
and unlike @code{setq}. Quote the argument yourself if that is what |
and unlike @code{setq}. Quote the argument yourself if that is what |
928 |
you want. |
you want. |
929 |
|
|
930 |
The ordering information is stored in an alist on @var{symbol}'s |
The ordering information is stored in a hash table on @var{symbol}'s |
931 |
@code{list-order} property. |
@code{list-order} property. |
932 |
@end defun |
@end defun |
933 |
|
|
952 |
(add-to-ordered-list 'foo 'd) ;; @r{Append @code{d}.} |
(add-to-ordered-list 'foo 'd) ;; @r{Append @code{d}.} |
953 |
@result{} (a c b d) |
@result{} (a c b d) |
954 |
|
|
955 |
(add-to-ordered-list 'foo 'b 2) ;; @r{Move @code{b}.} |
(add-to-ordered-list 'foo 'e) ;; @r{Add @code{e}}. |
956 |
@result{} (a b c d) |
@result{} (a c b e d) |
957 |
|
|
958 |
foo ;; @r{@code{foo} was changed.} |
foo ;; @r{@code{foo} was changed.} |
959 |
@result{} (a b c d) |
@result{} (a c b e d) |
960 |
@end example |
@end example |
961 |
|
|
962 |
@node Variable Scoping |
@node Variable Scoping |