type: special form (fsubr) location: built-in source file: xlcont.c and xlread.c Common LISP compatible: yes supported on: all machines
(backquote <expr> ) <expr> - an expression which is not evaluated except for comma and comma-at portions
BACKQUOTE returns the <expr> unevaluated - like QUOTE. The difference is that portions of the <expr> may be evaluated when they are preceeded by a COMMA (,) or COMMA-AT (,@). COMMA will evaluate the portion of the expression the comma preceeds. If the portion is an atom or a list, it is placed as is within the expression. COMMA-AT will evaluate the portion of the expression that the comma-at preceeds. The portion needs to be a list. The list is spliced into the expression. If the portion is not a list, COMMA-AT will splice in nothing.
(setq box 'stuff-inside) ; BOX contains STUFF-INSIDE (print box) ; prints STUFF-INSIDE (quote (i have the box)) ; returns (I HAVE THE BOX) (backquote (i have the box)) ; returns (I HAVE THE BOX) (backquote (I have (comma box))) ; returns (I HAVE STUFF-INSIDE) (backquote (I have the ,@box)) ; returns (I HAVE THE) (setq automobile '(a van)) ; set up AUTOMOBILE (backquote (I have automobile)) ; returns (I HAVE AUTOMOBILE) (backquote (I have (comma automobile))) ; returns (I HAVE (A VAN)) (backquote (I have ,@automobile)) ; returns (I HAVE A VAN) `(I have ,@automobile) ; returns (I HAVE A VAN)
READ MACRO: XLISP supports the normal read macro of a single reverse quote (`) as a short-hand method of writing the BACKQUOTE special form.
NOTE: BACKQUOTE and COMMA and COMMA-AT are very useful in defining macros via DEFMACRO.