Read an s-expression from the input port port, or from the current input port if port is not specified. Any whitespace before the next token is discarded.
The behaviour of Guile’s Scheme reader can be modified by manipulating its read options.
Display the current settings of the global read options. If
setting is omitted, only a short form of the current read options
is printed. Otherwise if setting is the symbol
complete options description is displayed.
The set of available options, and their default values, may be had by
read-options at the prompt.
scheme@(guile-user)> (read-options) (square-brackets keywords #f positions) scheme@(guile-user)> (read-options 'help) copy no Copy source code expressions. positions yes Record positions of source code expressions. case-insensitive no Convert symbols to lower case. keywords #f Style of keyword recognition: #f, 'prefix or 'postfix. r6rs-hex-escapes no Use R6RS variable-length character and string hex escapes. square-brackets yes Treat `[' and `]' as parentheses, for R6RS compatibility. hungry-eol-escapes no In strings, consume leading whitespace after an escaped end-of-line. curly-infix no Support SRFI-105 curly infix expressions.
Note that Guile also includes a preliminary mechanism for setting read
options on a per-port basis. For instance, the
read option is set (or unset) on the port when the reader encounters the
#!no-fold-case reader directives.
#!curly-infix reader directive sets the
curly-infix read option on the port, and
square-brackets on the port (see SRFI-105). There is
currently no other way to access or set the per-port read options.
The boolean options may be toggled with
read-disable. The non-boolean
keywords option must be set
Modify the read options.
read-enable should be used with boolean
options and switches them on,
read-disable switches them off.
read-set! can be used to set an option to a specific value. Due
to historical oddities, it is a macro that expects an unquoted option
For example, to make
read fold all symbols to their lower case
(perhaps for compatibility with older Scheme code), you can enter:
For more information on the effect of the
hungry-eol-escapes options, see (see String Syntax).