News for hackers. Stuff that matters.
Re:Why didn't Common Lisp fix the world? by sklogic on Tuesday May 17, 2016 @11:09AM (#11714280)
It puzzles me too, that people are not using the most powerful development technique.

I cannot imagine not using macros for pretty much everything I do.

Re:Why didn't Common Lisp fix the world? by wry_discontent on Tuesday May 17, 2016 @03:47PM (#11716740)
I've written a handful of Clojure and Emacs Lisp, but I don't get macros. How is a macro different than passing a quoted list to a function?

Maybe I just need to start slinging more lisp, but I don't see how they're particularly different from functions.

Re:Why didn't Common Lisp fix the world? by sklogic on Tuesday May 17, 2016 @05:51PM (#11717791)
> How is a macro different than passing a quoted list to a function?

Macro is a function that is executed in compile time. Think of it as a way of extending your compiler with new functionality. For example, your language does not have support for pattern matching originally. It's not a problem - you can define a macro that adds such a functionality to a language. You cannot do it with functions - it must be compiled and optimised before execution, and functions cannot introduce new identifiers into a scope.

Another simple example would be something like list comprehensions - also introducing variables and also requiring optimisations in compile time.

And at extreme level, macros can be used to turn your host language into something totally different. Not just add few new features, but turn it into another language. Lisp can become an ML or Haskell, or Prolog, or Java, or whatever else you can imagine. Macros can change syntax, can implement new semantics. None of it can be done with just functions.