On the other hand, macros operate at compile time or during macro-expansion time. They transform Lisp code before it is evaluated, returning new code to be compiled or evaluated later. This process allows for the extension of the language by defining new syntactic constructs, enabling the creation of powerful domain-specific languages (DSLs) and optimizations. An example provided is the macro `my-unless`, which expands into an `if` statement, demonstrating how macros can introduce new language features and syntactic sugar.
Key takeaways:
- Eval runs at runtime, taking a data structure and evaluating it as Lisp code.
- Macros run at compile time, transforming Lisp code before it's evaluated.
- Eval is used to dynamically construct and run code while the program is running.
- Macros are used to extend the language by defining new syntactic constructs, enabling powerful DSLs and optimizations.