quasiquote

[syntax] quasiquote template

R5RS, R6RS: "Backquote" or "quasiquote" expressions are useful for constructing a list or vector structure when most but not all of the desired structure is known in advance. If no commas appear within the template, the result of evaluating `template is equivalent to the result of evaluating ' template. If a comma appears within the <qq template>, however, the expression following the comma is evaluated ("unquoted") and its result is inserted into the structure instead of the comma and the expression. If a comma appears followed immediately by an at-sign (@), then the following expression must evaluate to a list; the opening and closing parentheses of the list are then "stripped away" and the elements of the list are inserted in place of the comma at-sign expression sequence. A comma at-sign should only appear within a list or vector template.

Note: Differences between R5RS and R6RS:

  • In R6RS, it is a syntax violation if quasiquote, unquote and unquote-splicing are used other than the way explicitly defined. In R5RS it was implementation-dependent.
  • In R6RS, it is explicitly stated that the portion of the template that do not need to be rebuilt at runtime are always literal.
  • In R6RS, unquote and unquote-splicing forms may have zero or more datums if they appear in the splicing position.

See also quote, `.