Package COM.INFORMATIMAGO.COMMON-LISP.CESARUM.SEQUENCE


This package exports sequence processing functions.


License:

    AGPL3

    Copyright Pascal J. Bourguignon 2004 - 2015

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Affero General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with this program.
    If not, see <http://www.gnu.org/licenses/>

(concatenate-sequences result-type sequence-of-sequences &key adjustable fill-pointer)
function
RESULT-TYPE:     Indicates the type of resulting sequence.
                 If LIST, then ADJUSTABLE and FILL-POINTER are ignored.

SEQUENCE-OF-SEQUENCES:
                 EACH element may be either a string-designator,
                 or a list containing a string-designator, and a start and end position
                 denoting a substring.

ADJUSTABLE:      Whether the result must be adjustable.

FILL-POINTER:    The result fill pointer.

RETURN:          A vector containing all the elements of the vectors
                 in sequence-of-vectors, in order.
(deletef x item &rest keys)
macro
Delete the item from the sequence in PLACE.
(duplicates sequence &key test key)
function
RETURN: A sequence of items appearing in SEQUENCE in duplicate.
        There are no duplicates in the result, a single representant
        is included.
(group-by sequence n)
generic-function
Returns a list of subsequences of SEQUENCE of length N,
whose concatenation is equal to SEQUENCE.
(hashed-delete-duplicates sequence &key test test-not start end key from-end)
function
Like DELETE-DUPLICATES but implemented using a HASH-TABLE.
(hashed-remove-duplicates sequence &key test test-not start end key from-end)
function
Like REMOVE-DUPLICATES but implemented using a HASH-TABLE.
(hashed-set-remove-duplicates sequence &key test key)
function
DO:       Remove duplicates from the SEQUENCE, using a hash-table.
RETURN:   A list of unique elements from the SEQUENCE.
SEQUENCE: A sequence.
TEST:     A comparison function.  Default: EQL.
KEY:      A key function. Default: IDENTITY.

MAPCONCAT

(parse-sequence-type type)
function
Parses the type which is expected to be a sequence subtype
RETURN:  the base type (list or vector), the element-type and the length (or nil).
(prefixp prefix sequence &key start end test)
generic-function
PREFIX:  A sequence designator.
STRING:  A sequence designator.
START:   The start of the subsequence of SEQUENCE to consider. Default: 0.
END:     The end   of the subsequence of SEQUENCE to consider. Default: NIL.
TEST:    A function to compare the elements of the SEQUENCE.
RETURN:  Whether PREFIX is a prefix of the (subseq SEQUENCE START END).
(replace-subseq insert sequence start &optional end)
generic-function

DO:             Destructively (if possible) replace the (subseq
                sequence start end) with the elements from INSERT.  If
                START and END don't specify a strict subseq of
                SEQUENCE then an error is signaled.

INSERT:         A sequence.

SEQUENCE:       A sequence.   If it is a list or an adjustable vector,
                or if the subseq is of same length as INSERT then it
                will be destructively modified and returned.
                Otherwise a fresh adjustable vector will be returned.

START:          Bounding index designator of SEQUENCE.

END:            Bounding index designator of SEQUENCE. The default for
                end is NIL, which means (LENGTH SEQUENCE).

RETURN:         Either the modified SEQUENCE, or a fresh sequence of
                the same type with the specified subseq replaced by
                elements from INSERT.

(suffixp suffix string &key start end test)
generic-function
SUFFIX:  A sequence designator.
STRING:  A sequence designator.
START:   The start of the subsequence of SEQUENCE to consider. Default: 0.
END:     The end   of the subsequence of SEQUENCE to consider. Default: NIL.
TEST:    A function to compare the elements of the SEQUENCE.
RETURN:  Whether SUFFIX is a suffix of the (subseq SEQUENCE START END).