Returns a list of subsequences of a sequence, split at specified separator elements.
lispworks
split-sequence separator-bag sequence &key start end test key coalesce-separators count => sequences
separator-bag⇩ |
A sequence. |
sequence⇩ |
A sequence. |
Bounding index designators for sequence. | |
test⇩ |
A function designator. |
key⇩ |
A function designator or nil . |
coalesce-separators⇩ |
A generalized boolean. |
count⇩ |
A positive integer, default most-positive-fixnum. |
sequences⇩ |
A list of sequences. |
The function split-sequence
returns a list of subsequences of sequence (bounded by start and end), split when an element in the sequence separator-bag is found. The structure of sequence is not changed and the elements matching separator-bag are not included in sequences.
The function test, which defaults to eql, is used to compare the elements of sequence and the elements of separator-bag.
If true, the function key, is applied to the elements of sequence before test is called.
If coalesce-separators is true, then empty sequences are omitted from sequences.
count specifies the maximum number of subsequences returned. The last subsequence consists of all the remaining elements of sequence.
(split-sequence '(#\space) "one two three") => ("one" "two" "three") (split-sequence '(#\space) "one two three" :count 2) => ("one" "two three")
LispWorks® User Guide and Reference Manual - 01 Dec 2021 19:30:41