2.4 Datum labels

lexical syntax: #n=datum
lexical syntax: #n#

The lexical syntax ‘#n=datum’ reads the same as ‘datum’, but also results in ‘datum’ being labeled by ‘n’. It is an error if ‘n’ is not a sequence of digits.

The lexical syntax ‘#n#’ serves as a reference to some object labeled by ‘#n=’; the result is the same object as the ‘#n=’ (see Equivalence predicates). Together, these syntaxes permit the notation of structures with shared or circular substructure.

(let (((list '''c)))
  (set-cdr! (cddr xx)
  x)#0=(a b c #0#)

The scope of a datum label is the portion of the outermost datum in which it appears that is to the right of the label. Consequently, a reference ‘#n#’ can occur only after a label ‘#n=’; it is an error to attempt a forward reference. In addition, it is an error if the reference appears as the labeled object itself (as in ‘#n= #n#’), because the object labeled by ‘#n=’ is not well defined in this case.

It is an error for a program or library to include circular references except in literals. In particular, it is an error for quasiquote (see Quasiquotation) to contain them.

#1=(begin (display #\x#1#)error