Lisp Macros
Discussions center on the power, ease of use, and unique features of macros in Lisp family languages like Common Lisp and Clojure, compared to macros in other languages such as Rust, Elixir, Haskell, and Scheme, often emphasizing homoiconicity and code-as-data.
Activity Over Time
Top Contributors
Keywords
Sample Comments
Why is it that Lisp family macros are easy to implement and use, but not so in other languages?
"has X so you don't need macros" is not equivalent to "has macros" (otherwise nearly every language could claim to be "a lisp.")
these days many newer languages have macros: lisp is not alone
I hear LISP has a pretty good macro system...
tldr it's not about macros it's about homoiconicity;
Try Elixir, it supports macros. Also Rust has Macros too. Although Lisp macros is different and may be more old fashion in some aspects, but it won't be hard to get the idea of code generating language, just pick one and try it.
What makes Common Lisp macros easier to use than Scheme's?
It's pretty trivial to add macros to any language. The only thing that separates a macro from a regular function is time. In a normal function, the parameters are evaluated before being sent to the function. In a macro, the function is called before the parameters are evaluated. What separates lisp from other languages when it comes to macros is that the language is very simple and provides lots of tools for operating on the same data structure that you write your code in.Of course you c
Can you give an example of something you can implement with a Lisp macro, but you can't implement with Haskell?
Any lisp will give you macros like you describe. If say lisp macros are more powerful and simpler too.