quasiquote (also called backquote) acts like quote, except that it generates code to create new list structure each time it is used.

Usually in Lisp, all function arguments are evaluated unless they are quoted. Within a quasiquote, that standard is locally reversed: everything is quoted unless it is prefixed by a comma (unquote), in which case it is evaluated. quasiquote is useful in defining macros. Macros that are defined using standard Lisp code do not ``look like'' the Lisp code that is output:

(define-macro neq?
  (lambda (x y)
    (list 'not (list 'eq? x y)) ))
Using quasiquote, the macro code looks more normal. The variables whose values are to be substituted into the new code are preceded by commas, and the new code itself is preceded by the backquote character:

(define-macro neq?
  (lambda (x y) `(not (eq? ,x ,y)) ))
quasiquote is just a short way of writing the same code shown in the first version of neq?.

Contents    Page-10    Prev    Next    Page+10    Index