backquote:
comma, comma-at:
The 'backquote' special form returns 'expr' unevaluated, like
quote. The difference is that portions of the
expression may be evaluated when they are preceeded by a 'comma' or
'
comma will evaluate the portion of the expression the comma
preceeds.
XLISP supports the following read macros:
|
`expression |
(backquote expression) |
|
|
,expression |
(comma expression) |
|
|
,@expression |
(comma-at expression) |
(setq box 'stuff-inside) => STUFF-INSIDE ; BOX contains STUFF-INSIDE (print box) => STUFF-INSIDE '(i have the box) ≡ (quote (i have the box)) => (I HAVE THE BOX) `(i have the box) ≡ (backquote (i have the box)) => (I HAVE THE BOX) `(i have the ,box) ≡ (backquote (i have the (comma box))) => (I HAVE THE STUFF-INSIDE) `(i have the ,@box) ≡ (backquote (I have the (comma-at box))) => (I HAVE THE) ; STUFF-INSIDE is not a list (setq automobile '(a van)) => (A VAN) ; AUTOMOBILE is a VAN (print automobile) => (A VAN) '(I have automobile) ≡ (quote (I have automobile)) => (I HAVE AUTOMOBILE) `(I have automobile) ≡ (backquote (I have automobile)) => (I HAVE AUTOMOBILE) `(I have ,automobile) ≡ (backquote (I have (comma automobile))) => (I HAVE (A VAN)) `(I have ,@automobile) ≡ (backquote (I have (comma-at automobile))) => (I HAVE A VAN)
Common errors:
`(,@(i am a list)) => error: bad function - I `(,@'(i am a list)) => (I AM A LIST)
Note: 'backquote', 'comma', and 'comma-at' are very useful in defining macros via defmacro.
See also: