Next: , Up: Reader & writer


4.6.1 Reader

Scheme48's reader facility is exported by the reading structure. The read binding thereby exported is identical to that of the scheme structure, which is the binding that R5RS specifies under the name read.

— procedure: read [port] –> readable-value

Reads a single S-expression from port, whose default value is the current input port. If the end of the stream is encountered before the beginning of an S-expression, read will return an EOF object. It will signal a read error if text read from port does not constitute a complete, well-formed S-expression.

— procedure: define-sharp-macro char proc –> unspecified

Defines a sharp/pound/hash/octothorpe (#) reader macro. The next time the reader is invoked, if it encounters an octothorpe/sharp followed by char, it applies proc to char and the input port being read from. Char is not consumed in the input port. If char is alphabetic, it should be lowercase; otherwise the reader will not recognize it, since the reader converts the character following octothorpes to lowercase.

— procedure: reading-error port message irritant ... –> unspecified

Signals an error while reading, for custom sharp macros. It is not likely that calls to reading-error will return.

— procedure: gobble-line port –> unspecified

Reads until a newline from port. The newline character sequence is consumed.