The less-familiar parts of Lisp for beginners — make-broadcast-stream

Next, we come to make-broadcast-stream.  This isn’t really a difficult concept to understand, but I highlight it because it’s not a primitive that appears in the C library, so a new Lisp programmer coming from C++ might not realize that this tool is available.  This function creates an output stream that transparently splits its data streams out into one or more target streams.  The most obvious uses for this are for setting up a mode that echos data to the screen as well as its normal output target, or for creating a unified transcript of client and server messages for debugging purposes.  Naturally, any other context where you want to send the same data to multiple output streams also benefits from this function.

Earlier in this series I skipped broadcast-stream-streams as I was waiting to include it with make-broadcast-stream.  The broadcast-stream-streams function returns a list of the streams to which the broadcast stream sends its output.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>


反垃圾邮件 / Anti-spam question * Time limit is exhausted. Please reload CAPTCHA.