At its best, programming in Lisp is an iterative process of building up a language appropriate to the problem at hand, and then solving the problem in that language. Defining new procedures is part of that, but Lisp also allows the user to extend its syntax, with its famous macros.
Macros are syntactic extensions which cause the expression that they appear in to be transformed in some way before being evaluated. In expressions that are intended for macro transformation, the identifier that names the relevant macro must appear as the first element, like this:
(macro-name macro-args …)
Macro expansion is a separate phase of evaluation, run before code is interpreted or compiled. A macro is a program that runs on programs, translating an embedded language into core Scheme13.
|• Defining Macros:||Binding macros, globally and locally.|
|• Syntax Rules:||Pattern-driven macros.|
|• Syntax Case:||Procedural, hygienic macros.|
|• Syntax Transformer Helpers:||Helpers for use in procedural macros.|
|• Defmacros:||Lisp-style macros.|
|• Identifier Macros:||Identifier macros.|
|• Syntax Parameters:||Syntax Parameters.|
|• Eval When:||Affecting the expand-time environment.|
|• Internal Macros:||Macros as first-class values.|
These days such embedded languages are often referred to as embedded domain-specific languages, or EDSLs.