make-echo-stream
(make-echo-stream input-stream output-stream)
A two-way stream that also writes everything it reads to the output component — the interactive-echo idiom.
The input side is a Gray stream, so read-line
and read-char dispatch over it and each character read is echoed to the output
component along the way; write-char / write-string reach the output side
directly. Only what is read echoes: peek-char looks at the input component
without writing. The components are recoverable with
echo-stream-input-stream and
echo-stream-output-stream.
Each component must stream in the right direction: an input stream that is not
one, or an output stream that is not one, signals a type-error.