defcm|| ||name lambda-list
[[declaration* | documentation]]
Define a read-time conditional compiler macro.
Arguments and values
|name|| || A non-|
nil, non-keyword symbol that names a function or macro
|lambda-list|| || A lambda-list
|declaration|| || A declare expression (not evaluated)
|documentation|| || A documentation string (not evaluated)
|form|| || A form
The supplied name.
Defcm is a read-time conditional version of Common Lisp's
define-compiler-macro. As with
A compiler macro is not defined if the feature
:disable-compiler-macros or the feature
:full-safety is present when the expander
function is executed on a form.
- The expander function is installed as a compiler macro function for
&whole argument is bound to the form argument that is passed
to defcm. The remaining lambda-list
parameters are specified as if this form contained the function name in the
car and the actual arguments in the cdr. However, if the car of the actual
form is the symbol
funcall, then the destructuring of the
arguments is actually performed using its cddr instead.
- Documentation is attached as a documentation string to name (as kind
compiler-macro) and to the compiler macro function.
- A compiler macro can decline to provide an expansion merely by returning
the original form (which can be obtained by using
Here is the compiler macro defined for ensure-list:
> (defcm ensure-list (x)
`(if (listp ,x) ,x (list ,x))))
The GBBopen Project