User Tools

Site Tools


ch2_1_backquote

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.

ch2_1_backquote.txt · Last modified: 2022/02/23 05:54 by admin

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki