3 ms·
> that the power of lisp macros comes from this questionable, but distinctively lispy, syntax No. It comes from homoiconicity. In this case, everything is a li
by shakna 9y ago
> that the power of lisp macros comes from this questionable, but distinctively lispy, syntax
No. It comes from homoiconicity. In this case, everything is a list. Because Lisp has great support for modifying lists, you can do some wonderful things with it. Wisp [1] comes without parentheses, but still has the same macro system, and the same power.
> If there were some better known examples of what lisp macros were good for
When the language gets in your way. That's it. Everything else can be a lambda. Lisp macros only start to seem pointless, because Lisp itself is a flexible language.
But, some real world macro examples?
Mutating functions. (setf and the like.)
Compile-time contracts. [0]
You have a key-value list that you dynamically constructed, and want to bind it. Let can't just take a list, but a macro can handle it.
Killing boilerplate, that involves bound values. (This one spoils you. Other languages become infuriatingly inflexible about it.)
[0] Can't find the paper right now, but it relied on compile-time macros to validate types at compile time in a (large) subset of Common Lisp.
[1] http://dustycloud.org/blog/wisp-lisp-alternative/ http://dustycloud.org/blog/wisp-lisp-alternative/