1 Beginning Student
2 Beginning Student with List Abbreviations
3 Intermediate Student
4 Intermediate Student with Lambda
5 Advanced Student
Index
On this page:
quasiquote
unquote
unquote-splicing
Version: 4.0.2

 

2.2 Quasiquote

`quasiquoted

(quasiquote quasiquoted)

Creates symbols and abbreviates nested lists, but also allows escaping to expression “unquotes.”

Normally, this form is written with a backquote, `, like `(apple ,(+ 1 2)), but it can also be written with quasiquote, like (quasiquote (apple ,(+ 1 2))).

,quasiquoted

(unquote expr)

Under a single quasiquote, ,expr escapes from the quote to include an evaluated expression whose result is inserted into the abbreviated list.

Under multiple quasiquotes, ,expr is really ,quasiquoted, decrementing the quasiquote count by one for quasiquoted.

Normally, an unquote is written with ,, but it can also be written with unquote.

,@quasiquoted

(unquote-splicing expr)

Under a single quasiquote, ,@expr escapes from the quote to include an evaluated expression whose result is a list to splice into the abbreviated list.

Under multiple quasiquotes, a splicing unquote is like an unquote; that is, it decrements the quasiquote count by one.

Normally, a splicing unquote is written with ,, but it can also be written with unquote-splicing.