The R7RS-small standard, section 4.2.8 Quasiquotation on page 20-21 says that
(let ((a 3)) `((1 2) ,a ,4 ,'five 6))
is equivalent to
-
`((1 2) 3 4 five 6)
and
-
(let ((a 3)) (cons '(1 2) (cons a (cons 4 (cons 'five '(6))))))
But not equivalent to:
(let ((a 3)) (list (list 1 2) a 4 'five 6))
How can the expression above be any different from the first three? All four expressions above evaluate to the same thing: '((1 2) 3 4 five 6)
.
The reason is given a few lines before the example (emphasis is mine):
This means that in:
the part
(1 2)
inside the quasiquote must be treated as a literal, as in...'(1 2)...
and not as a structure built from its components, like in:...(list 1 2)...
.This seems to be an overspecification, since
'(1 2)
prints exactly like(list 1 2)
, but the first list cannot be mutated (or, better, there is an undefined behaviour if mutated), while the second one can be legally mutated.