-
Notifications
You must be signed in to change notification settings - Fork 0
/
io.tex
18 lines (12 loc) · 1.58 KB
/
io.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
%!TEX root = reference.tex
\chapter{Input and Output}
\label{io}
Input and output features include mechanisms for reading and writing streams of characters, mechanisms for accessing and navigating file directories and mechanisms for the appropriate formatting and parsing of data.
The I/O streaming features are organized into a number of layers:
\begin{itemize}
\item At the `block' layer, an I/O operation is represented as a \q{task} -- see Chapter~\vref{concurrent} and Chapter~\vref{computation}. The value of an input task is typically some fragment of data from the input. An output task always has \q{()} as its value.
\item At the data layer, I/O operations are represented via lazily executed \q{sequence}s of terms. In particular, it is possible to use the sequence notation -- see Section~\vref{sequenceNotation} to represent streams of data being consumed or produced.
\end{itemize}
In addition to the layering of lazy streams on top of block data, there is a natural distinction in the handling of input vs output.
For processing input, the dominant metaphor is one of \emph{parsing}: the input occurrence is parsed in order to extract the required data in terms of the application. For example, an application processing a sequence of records of people would prefer the input to be a sequence of \q{person} records.
For generating output, being able to emit \q{person} records is important. It is also important to be able to intersperse such records with fragments of canned text. Thus the natural data type for elements of output is the \emph{structured string} -- see Section~\vref{ppType}.