2.3 Literals: quote and #%datum
Many forms are implicitly quoted (via #%datum) as literals. See Expansion Steps for more information.
Quoting: quote and ’ in Guide: Racket introduces quote.
| (quote datum) |
Produces a constant value corresponding to datum (i.e., the
representation of the program fragment) without its lexical
information, source location, etc. Quoted pairs, vectors, and boxes
are immutable.
Examples: |
| > (quote x) |
'x |
| > (quote (+ 1 2)) |
'(+ 1 2) |
| > (+ 1 2) |
3 |
| (#%datum . datum) |
Expands to (quote datum), as long as
datum is not a keyword. If datum is a keyword, a
syntax error is reported.
See also Expansion Steps for information on how the expander introduces #%datum identifiers.
Examples: |
| > (#%datum . 10) |
10 |
| > (#%datum . x) |
'x |
| > (#%datum . #:x) |
eval:471:0: #%datum: keyword used as an expression in: #:x |
