Common Lisp Package: COM.INFORMATIMAGO.COMMON-LISP.CESARUM.SEQUENCE

This package exports sequence processing functions. License: AGPL3 Copyright Pascal J. Bourguignon 2004 - 2012 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/>

README:

FUNCTION

Public

DUPLICATES (SEQUENCE &KEY (TEST 'EQL) (KEY 'IDENTITY))

RETURN: A sequence of items appearing in SEQUENCE in duplicate. There are no duplicates in the result, a single representant is included.

HASHED-DELETE-DUPLICATES (SEQUENCE &KEY (TEST #'EQL) TEST-NOT (START 0) (END (LENGTH SEQUENCE)) (KEY #'IDENTITY) (FROM-END NIL))

Like DELETE-DUPLICATES but implemented using a HASH-TABLE.

HASHED-REMOVE-DUPLICATES (SEQUENCE &KEY (TEST #'EQL) TEST-NOT (START 0) (END (LENGTH SEQUENCE)) (KEY #'IDENTITY) (FROM-END NIL))

Like REMOVE-DUPLICATES but implemented using a HASH-TABLE.

HASHED-SET-REMOVE-DUPLICATES (SEQUENCE &KEY (TEST #'EQL) (KEY #'IDENTITY))

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.

Private

Undocumented

TEST/REPLACE-SUBSEQ

GENERIC-FUNCTION

Public

REPLACE-SUBSEQ (INSERT SEQUENCE START &OPTIONAL END)

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.