| www.delorie.com/gnu/docs/emacs/cl_48.html | search |
![]() Buy the book! | |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This section describes a number of Common Lisp functions for operating on sequences.
As an extension to Common Lisp, start and/or end
may be negative, in which case they represent a distance back
from the end of the sequence. This is for compatibility with
Emacs' substring function. Note that subseq is
the only sequence function that allows negative
start and end.
You can use setf on a subseq form to replace a
specified range of elements with elements from another sequence.
The replacement is done as if by replace, described below.
vector, string, or list. The
arguments are always copied, even in cases such as
(concatenate 'list '(1 2 3)) where the result is
identical to an argument.
If seq1 and seq2 are eq, then the replacement
will work correctly even if the regions indicated by the start
and end arguments overlap. However, if seq1 and seq2
are lists which share storage but are not eq, and the
start and end arguments specify overlapping regions, the effect
is undefined.
eq to seq in some circumstances, but the original
seq will not be modified. The :test, :test-not,
and :key arguments define the matching test that is used;
by default, elements eql to item are removed. The
:count argument specifies the maximum number of matching
elements that can be removed (only the leftmost count matches
are removed). The :start and :end arguments specify
a region in seq in which elements will be removed; elements
outside that region are not matched or removed. The :from-end
argument, if true, says that elements should be deleted from the
end of the sequence rather than the beginning (this matters only
if count was also specified).
remove*
for those sequence types. On lists, remove* will copy the
list if necessary to preserve the original list, whereas
delete* will splice out parts of the argument list.
Compare append and nconc, which are analogous
non-destructive and destructive list operations in Emacs Lisp.
The predicate-oriented functions remove-if, remove-if-not,
delete-if, and delete-if-not are defined similarly.
:test, :test-not, and :key
arguments, only the rightmost one is retained. If :from-end
is true, the leftmost one is retained instead. If :start or
:end is specified, only elements within that subsequence are
examined or removed.
remove-duplicates.
:count,
:start, :end, and :from-end arguments may be
used to limit the number of substitutions made.
substitute; it performs
the substitution using setcar or aset rather than
by returning a changed copy of the sequence.
The substitute-if, substitute-if-not, nsubstitute-if,
and nsubstitute-if-not functions are defined similarly. For
these, a predicate is given in place of the old argument.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| webmaster donations bookstore | delorie software privacy |
| Copyright © 2003 by The Free Software Foundation | Updated Jun 2003 |