Previous: , Up: scheme lex datum   [Index]


3.4.4.5 Abbreviations

 '<datum>        `<datum>        ,<datum>
,@<datum>       #'<datum>       #`<datum>
#,<datum>      #,@<datum>

Each of these is an abbreviation:

'<datum>

for (quote <datum>),

`<datum>

for (quasiquote <datum>),

,<datum>

for (unquote <datum>),

,@<datum>

for (unquote-splicing <datum>),

#'<datum>

for (syntax <datum>),

#`<datum>

for (quasisyntax <datum>),

#,<datum>

for (unsyntax <datum>), and

#,@<datum>

for (unsyntax-splicing <datum>).

Notice that it is the source code reader (the lexer and parser) which builds the symbolic expression:

(quote (a b c))

from the sequence of characters:

'(a b c)

and this happens before any library is loaded, so the source code expander only sees the symbolic expression with the quote symbol in it. So, while the following program works because the library (rnrs) exports the quote identifier:

#!r6rs
(import (rnrs))
(write '(a b c))

the following program will fail:

#!r6rs
(import (except (rnrs) quote))
(write '(a b c))

in exactly the same way the following program will fail:

#!r6rs
(import (except (rnrs) quote))
(write (quote (a b c)))

because we have explicitly excluded quote from the import set. The same happens with syntax and the other abbreviations.

Summary: once our eyes have adapted to use the abbreviations, and it may take a while, they are of friendly usage; but we have to remember to import libraries exporting quote, syntax and the other abbreviated identifiers.