3 ms·
I read the defmacro link and found it very interesting and cool; but I still feel as if I'm missing what makes this so earth-shattering? Do not get me wrong - i
by stnmtn 4y ago
I read the defmacro link and found it very interesting and cool; but I still feel as if I'm missing what makes this so earth-shattering? Do not get me wrong - it is insanely cool and wonderful to be able to modify lisp's syntax with lisp... but it just seems like that... it's cool. I don't see why this would be any different than defining a function like I normally do.
Sure, I can create an entirely new operator that becomes valid syntax, like `*` which creates an exponential operator. But why is this more productive than simply defining a "exponent()" function or something similar?
It seems also that tech debt would accrue incredibly fast as joining a lisp codebase would require learning almost an entirely new set of syntax. I'm sure I 'm missing something, but I can't see at all why I need to learn LISP. It's cool, neat, and wonderful... but that's about it from my understanding.
- dunefox 4y agoIt's not easy to get the point across just by reading about it. Id honestly say you should just learn some lisp and implement something cool. > I don't see why this would be any different than defining a function like I normally do. Because with functions you don't define any new syntax or implement a DSL; you don't have access to the compiler during read, compilation, and run time. This allows you to easily extend the language: do you miss list comprehensions from Python? Add it yourself with a macro. Want to generate boilerplate code? Macro. Prolog compiler? Yes. Basically anything in this book: https://github.com/norvig/paip-lisp https://github.com/norvig/paip-lisp > But why is this more productive than simply defining a "exponent()" function or something similar? It's not just about defining a new operator, you can basically implement a DSL with C-like syntax if you want to: https://github.com/y2q-actionman/with-c-syntax https://github.com/y2q-actionman/with-c-syntax