(defmacro name (arg*) [doc-string] form*)
Macros are functions that do not evaluate their arguments but use them as given in order to construct and return lisp code which is then compiled and executed.
Typically, the return value of a macro is a backquote (aka quasiquote) expression:
user 1 > (defmacro my-trace (expr) (when $debug-mode (var result (gentemp)) `(when $tracing (var ,result ,expr) (write-line (string ,(write-to-string expr :escape true) " => " (write-to-string ,result :escape true)) :stream $stdlog)))) it: my-trace
The code returned by this macro is always
null in no-debug mode, but otherwise...
user 1 > (macroexpand '(my-trace (setq x (blabla)))) it: (if $tracing (do? (var temp:temp-544 (setq x (blabla))) (write-line (string "(setq x (blabla))" " => " (write-to-string temp:temp-544 :escape true)) :stream $stdlog)))