2 ms·
You usually use macros to change the semantics of Lisp: (foo (bar) (baz)) If foo is a function, then (bar) will be evaluated, (baz) will be evaluated and th
by aidenn0 6y ago
You usually use macros to change the semantics of Lisp:
(foo (bar) (baz))
If foo is a function, then (bar) will be evaluated, (baz) will be evaluated and then (foo X Y) will be evaluated where X and Y are the results of evaluating (bar) and (baz).
If foo is a macro, then none of the above is necessarily true. Macros let you implement new control-flow constructs, which may be necessary for a DSL (or at least a low-boilerplate DSL; you can always make ugly control-flow by wrapping every expression in a lambda, but the idea is to make something easier to write, not something harder to write)
- guenthert 6y agoIdeally, you make something easier to read.