[ < ] [ > ] [ << ] [ Up ] [ >> ] [Top] [Contents] [Index] [ ? ]

### 9.18.2 Slicing sequence

Generic function: subseq (seq <sequence>) &optional start end
Retrieve a subsequence of the sequence seq, from start-th element (inclusive) to end-th element (exclusive). If end is omitted, up to the end of sequence is taken. The type of the returned sequence is the same as seq.

 ```(subseq '(a b c d e) 1 4) => (b c d) (subseq '#(a b c d e) 1 4) => #(b c d) (subseq "abcde" 1 4) => "bcd" (subseq '(a b c d e) 3) => (d e) ```

Generic function: (setter subseq) (seq <sequence>) start end value-seq
Generic function: (setter subseq) (seq <sequence>) start value-seq
Sets the elements of value-seq from the start-th element (inclusive) to the end-th element (exclusive) of the sequence seq. Value-seq can be any sequence, but its size must be larger than (end - start).

In the second form, end is figured out by the length of value-seq.

 ```(define s '#(a b c d e)) (set! (subseq s 1 4) '(4 5 6)) s => #(a 4 5 6 e) (set! (subseq s 0) "ab") s => #(#\a #\b 5 6 e) ```

This document was generated by Ken Dickey on November, 28 2002 using texi2html