Previous: Other notations, Up: Lexical conventions [Index]
The lexical syntax #
⟨n⟩=
⟨datum⟩ reads the same
as ⟨datum⟩, but also results in ⟨datum⟩ being labelled 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 labelled 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 ((x (list 'a 'b 'c))) (set-cdr! (cddr x) x) 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
labelled object itself (as in #
⟨n⟩=
#
⟨n⟩#
), because the object labelled 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 (Quasiquotation) to contain them.
#1=(begin (display #\x) #1#) ⇒ error