copy-seq
copy-seq sequence → copied-sequence
sequence—a proper sequence.
copied-sequence—a proper sequence.
14.1.0 8Creates a copy of sequence. The elements of the new sequence are the same as the corresponding elements of the given sequence.
Moon's suggested interpretation follows:
If sequence is a vector, the result is a fresh simple array of rank one that has the same actual array element type as sequence. If sequence is a list, the result is a fresh list.
End Moon's suggested interpretation.
(setq str "a string") → "a string" (equalp str (copy-seq str)) → true (eql str (copy-seq str)) → false
None.
None.
Should be prepared to signal an error of type type-error if sequence is not a proper sequence.
From a functional standpoint,
(copy-seq x) ≡ (subseq x 0)However, the programmer intent is typically very different in these two cases.