MTS 8: LISP and SLIP in MTS
Page Revised February 1979 June 1976
INPUT/OUTPUT IN LISP ____________________
Default I/O Operations ______________________
In the simplest application of LISP input/output, all input is read
from the system input device SCARDS, and all output is directed to the
system output device SPRINT. I/O is always treated as a stream, with
the syntactic boundaries between S-expressions, rather than physical
records, constituting the divisions between I/O operations. Thus,
several S-expressions may be read from one input line; one S-expression
may span several input lines. Similarly, the basic print function PRIN1
will "stream" output S-expressions into a single output buffer until it
overflows. Contents of the buffer will be printed, and the remainder of
the current expression will be continued as a new buffer.
(READ) Calling READ with no arguments causes one
S-expression to be read from the system input
device. The structure represented by the
S-expression will be returned.
(READCH) Gets the next character from the current input
stream. Blanks, periods, parentheses, etc., as well
as alphanumeric characters, are returned as one-
character atoms.
(READLINE) Causes a new line to be read from the system input
device into the system input buffer. The previous
contents of the buffer are destroyed, and the next
READ will begin with the new line. The value
returned from READLINE is a pointer to the buffer,
which is described in the next subsection.
(PRIN1 S) Causes the list or S-expression form of the LISP
structure S to be "printed" into the system output
buffer. Each S-expression printed will be preceded
by a blank. When the buffer is full, its contents
will be printed on the system output device, and
printing of the remainder of the print name of S
will be continued at the beginning of the empty
buffer.
The value returned from PRIN1 is S.
(TERPRI) Terminates the system output buffer, causing its
current contents (if any) to be printed, and the
buffer to be cleared. If there is nothing in the
buffer, TERPRI has no effect. The value of TERPRI
is NIL.
(PRINT S) Operates like (PROGN (TERPRI) (PRIN1 S) (TERPRI)),
except that the value returned from PRINT is S.
46 LISP