14. I/O: Streams and Files

Communication between COMMON LISP and the “world outside” is usually performed via streams, whether you are interacting with files, with network connections, or with your IDE. These streams, which can be character streams (for textual data of all kinds) or binary streams (to transfer bits in chunks of bytes), are conceptually easy to use but still remarkably flexible and they are ultimately also used by the Lisp reader (see Chapter 8) and the Lisp printer (see Chapter 9). This chapter is about the various ways you can use, adapt, and combine streams and it ends with a recipe that demonstrates how you can create your own stream classes for almost every task you can imagine.

(See also Recipe 3-3.)

14-1. Redirecting Streams ...

Get Common Lisp Recipes: A Problem-Solution Approach now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.