1

I understand how quotes are represented in language:

(equal ''(1 2) (list 'quote (list 1 2))) ;; => T

but what about quasi-quotes? is it something like:

(equal ``(1 2) (list '<???> (list 1 2)))

Both quasiquote and backquote instead of <???> don't work.

aaalex88
  • 619
  • 4
  • 13

2 Answers2

3

There is no standard representation in Common Lisp. What backquote should do is specified, but there is no equivalent to quote. In particular the spec says in 2.4.6, after giving the specification of how backquote should behave:

An implementation is free to interpret a backquoted form F1 as any form F2 that, when evaluated, will produce a result that is the same under equal as the result implied by the above definition, provided that the side-effect behavior of the substitute form F2 is also consistent with the description given above.

Note that this is not in fact a problem since backquote is a thing you can implement yourself, while quote needs to be in the guts of the language.

  • 1
    That text is misusing the word "form" in "backquoted form". A form is an object to be evaluated. No object is a backquoted-anything; that's read syntax, or an *expression* (in sense 2, as given by the Glossary). – Kaz Mar 13 '20 at 17:23
  • @Kaz: I think what it means by 'backquoted form' is what it describes earlier as a 'form denoted by `[...]' (my ellipsis), which as you say is a sense-2 expression. But, well, that's what was written. –  Mar 13 '20 at 18:08
2

Generally there is no representation required:

 '`(1 2) -> '(1 2)

 '`(,1 2) -> '(1 2)

 '`(,a 2) -> (list* a '(2))

Implementations may expand into special constructs, so that backquote expressions can also be printed as backquote expressions.

Rainer Joswig
  • 136,269
  • 10
  • 221
  • 346