&keystart1 end1 start2 end2 → sequence-1
Sequence-1 is destructively modified by copying successive elements into it from sequence-2. elements of the subsequence of sequence-2 bounded by start2 and end2 are copied into the subsequence of sequence-1 bounded by start1 and end1. If these subsequences are not of the same length, then the shorter length determines how many elements are copied; the extra elements near the end of the longer subsequence are not involved in the operation. The number of elements copied can be expressed as:
If sequence-1 and sequence-2 are the same object and the region being modified overlaps the region being copied from, then it is as if the entire source region were copied to another place and only then copied back into the target region. However, if sequence-1 and sequence-2 are not the same, but the region being modified overlaps the region being copied from (perhaps because of shared list structure or displaced arrays), then after the replace operation the subsequence of sequence-1 being modified will have unpredictable contents. It is an error if the elements of sequence-2 are not of a type that can be stored into sequence-1.
(replace "abcdefghij" "0123456789" :start1 4 :end1 7 :start2 4) → "abcd456hij" (defparameter *lst* "012345678") → "012345678" (replace *lst* *lst* :start1 2 :start2 0) → "010123456" *lst* → "010123456"
The sequence-1 is modified.