Syntax
- Reader (case-sensitive):
#t#f#true#false, integers, decimals, rationals,+inf.0-inf.0+nan.0-nan.0(in any case),#x#b#o#d,|...|identifiers of any characters (with\|and the string escapes; never case-folded),#\a#\space#\newline#\x41, strings with\n \t \" \\ \xHH;,#( )vectors,#u8( )bytevectors, dotted pairs,'`,,@,;,#;,#| |#,#!fold-case/#!no-fold-case(per file, folding identifiers and character names asstring-foldcasedoes -- not strings, not the character itself -- until the counterpart directive or end of file). - Special forms: one page each under Syntax in the
reference (
delayanddelay-forceunder (scheme lazy),case-lambdaunder (scheme case-lambda)), and(import (scheme base) (scheme write) (scheme read) (scheme char) (scheme inexact) (scheme cxr) (scheme lazy) (scheme case-lambda) (scheme process-context) (scheme eval) (scheme repl) (scheme file))withonly/except/prefix/rename.
See Libraries for what each of those twelve libraries exports, and
Structure and Interpretation of Computer Programs (SICP) Compatibility for the
names visible with no import at all.
Macros
define-syntax, let-syntax and letrec-syntax with syntax-rules transformers:
literals, _, ... (nested, followed by more patterns, in a dotted tail, in a vector),
a custom ellipsis (syntax-rules ::: (literal ...) rule ...), the (... ...) escape,
and syntax-error. A syntax definition may stand at the top level or at the head of a
body; a macro may expand into definitions, begin included.
Macros are hygienic: a variable the template binds (tmp below) captures nothing the
user wrote, and a name the template uses freely (if below) means what it meant where
the macro was defined, whatever the use site binds.
(2 1)
5
The limits: only syntax-rules transformers; a macro is visible in the file that
defines it (a (load ...)ed file does not see the loader's macros, nor the other way
round); names a template introduces into a top-level define-record-type are not renamed; eval
knows no macro and refuses define-syntax.