6DATA
This chapter is all about data: reading it, writing it, visualizing it, and analyzing it. We’ll begin with a discussion of input and output using Racket ports (an essential tool we’ll use throughout this chapter).
I/O, I/O, It’s Off to Work We Go
Data is transferred in Racket via ports: data flows into an input port and out of output ports. The general process of transferring data to or from an external source (such a text file or database server) is referred to as I/O. Let’s look at some examples of ports.
File I/O Ports
Ports can be used for writing and reading data to a file, as the following dialog illustrates.
> ; Output some stuff ...
Get Racket Programming the Fun Way 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.