Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Macro System

The macro system is the distinguishing feature of LFE. It provides:

  • Compile-time metaprogramming: Transform code before compilation
  • Syntactic abstraction: Create new language constructs
  • Code generation: Generate repetitive code automatically
  • DSL creation: Embed domain-specific languages

Two macro styles:

  1. Procedural macros (Common Lisp style): Full Turing-complete transformations
  2. Pattern macros (Scheme style): Declarative syntax-rules with pattern matching