|
|
|
|
|
by arohner
4098 days ago
|
|
Macros hinge on the idea that code is data. Macros are functions that run at "compile-time" [1], that take unevaluated code (i.e. data) and return any valid data, it just happens that returning a list is interpreted as a function call. But I can also define: (defmacro foo [x] :foo) which always returns a keyword. All lisps that I'm aware of only let macros dispatch on list evaluation, i.e. when you see (foo ...), call the function defined in (defmacro foo), but I'm not aware of any limitation preventing you from applying that to other types of data. [1] technically, they run at macro-expansion time, which is after reading the expression, and before evaluating. |
|