- Square brackets (``['' and ``]'') and curly braces
(``{'' and ``}'') can always be used in place of parentheses. An
open square bracket must be closed by a closing square bracket and an
open curly brace must be closed by a closing curly brace.
- Vector constants can be unquoted, and a vector size can
be specified between the ``#'' and opening parenthesis. If the
specified size is larger than the number of vector elements that
are provided the last specified element is used to fill the
remaing vector slots. If no vector elements are specified, the vector
is filled with 0. If a vector size is provided and it
is too large or it is smaller than the number of elements provided,
the exn:read:vector-length exception is raised.
- Boxed constants can be created using #&. The S-expression
following #& is treated as a quoted constant and put into the
new box. (Spaces following the #& are ignored.) Box reading
is controlled with read-accept-box; this procedure takes zero
arguments to return the current mode, or one Boolean argument to set the mode.
Box reading is on by default. When box reading is off and #&
is provided as input, the exn:misc:unsupported exception is raised.
- The following character constants are recognized:
- #
nul or #
null (ASCII 0) - #
backspace (ASCII 8) - #
tab (ASCII 9) - #
newline (ASCII 10) - #
linefeed (ASCII 10) - #
page (ASCII 12) - #
return (ASCII 13) - #
space (ASCII 32) - #
rubout (ASCII 127)
Whenever #
is followed by at least two alphabetic
characters, characters are read from the input port until the next
non-alphabetic character is returned. If the resulting string of
letters does not match one of the above constants (case
insensitively), the exn:read:char exception is raised.
Character constants can also be specified through direct ASCII values
in octal notation: #
n
n
n
where
n
is in the range [0, 3] and n
and
n
are in the range [0, 7]. Whenever #
is
followed by at least two characters in the range [0, 7],
the next character must also be in this range and the resulting octal
number must be in the range
to
.
- Symbols containing non-standard
characters (including spaces) are expressed using an escaping
backslash (
) or quoting vertical bars (
). A
backslash preceeding any character includes that character in the
symbol literally; double backslashes produce a single backslash in the
symbol. Also, one or more symbol characters can be quoted using
vertical bars. Quoting bars can be used for any part of a symbol, or
the whole symbol can be quoted. Backslashes and quoting bars can be
mixed within a symbol, but a backslash is not a special
character within a pair of quoting bars. Input syntax containing a
backslash or vertical bars will never be treated as a numerical
contant.
Examples:
- (quote a
(b) produces the same
symbol as (string->symbol "a(b"). - (quote a
b), (quote |a b|),
and (quote a| |b) all produce
the same symbol as (string->symbol "a b"). - (quote |a||b|) is the same as (quote ab).
- (quote 10) is the fixnum 10, but (quote |10|) produces
the same symbol as (string->symbol "10").
Whether a vertical bar is used as a special or normal symbol character
is controlled with read-accept-bar-quote; this procedure
takes zero arguments to return the current mode, or one Boolean
argument to set the mode. Vertical bar quotes are on by default.
- S-expressions with shared stucture are expressed using
#n= and #n#. See section 3.3.
- Expressions of the form #<x> are read as special
type symbol values (they are not symbols). This feature insures that all printed Scheme values are
handled by read. The x part is any expression that is
acceptable as a symbol; additionally, x can contain (unquoted)
spaces.
For any x, (eq? #<x> #<x>)
is #t, but #<x> is not equal? to
anything else. (quote #<x>) is the same as
#<x>.
(type-symbol? x) returns #t
if x is a type symbol, or #f otherwise. Type symbol
reading is controlled with read-accept-type-symbol; this
procedure takes zero arguments to return the current mode, or one
Boolean argument to set the mode. Type symbol reading is on by default.
When type symbol reading is off and a type symbol is provided as input,
the exn:read:unsupported exception is raised.
- Expressions of the form #%x are symbols. See
section 3.7.
- Expressions beginning with #` are interpreted as
compiled MzScheme code. See section 3.17.
- Multi-line comments are started with #| and
terminated with |#. Comments of this form can be nested
arbitrarily.
- If the first line of a loaded file begins with
#!, it is ignored by the default load handler. If an
ignored line ends with a backslash (
), then the next
line is also ignored.