1 Language Model
2 Syntactic Forms
3 Datatypes
4 Structures
5 Classes and Objects
6 Units
7 Contracts
8 Pattern Matching
9 Control Flow
10 Concurrency
11 Macros
12 Input and Output
13 Reflection and Security
14 Operating System
15 Memory Management
16 Running PLT Scheme
Bibliography
Index
On this page:
quote
#%datum
Version: 4.0.2

 

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: PLT Scheme 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:7:0: #%datum: keyword used as an expression in: #:x