BACKQUOTE
Backquote expects one argument, typically a list, and can be also invoked with the backquote special character `
. In the example for quote form, the backquote form works the same:
`(a b c) ; backquote here is .. (backquote (a b c)) ; .. same as quote
But in backquoted list, some parts can be switched back to evaluation with comma character (see UNQUOTE
):
>`(a ,(+ 1 2) c) ; backquoted list (A 3 C) ; form (+ 1 2) evaluated
While with normal quote we would have this:
>'(a ,(+ 1 2) c) ; quoted list (A (UNQUOTE (+ 1 2)) C) ; comma character expanded, but not evaluated
And multiple backqoutes are ignored:
>``(a ,(+ 1 2) c) ; multiple backquoting .. (A 3 C) ; .. behaves as single backquote
The forms BACKQUOTE
, UNQUOTE
and SPLICE-UNQUOTE
are useful for writing macros.