changed-stream
Is a lisp library for non-destructive changing of streams by inserting or deleting characters at a position. It lets you non-destructively ‘change’ an input stream, by specifying a) where the change occurs, b) how many characters were deleted at that point and c) what characters where typed-in at that point.

It's well tested, and has a pretty good manual.

(with-input-from-string (s "0123456789") (let ((d (change-stream s :at 3 :delete 1 :insert "xyz"))) (read-line d))) ;; "012xyz456789"

For more info see:

ASDF-install package (obsolete) https://github.com/WarrenWilkinson/changed-stream/tarball/master

Topics: stream, Text, Warren Wilkinson