O'Reilly logo

Mastering Clojure Macros by Colin Jones

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Metaprogramming in Non-Lisps

Lisp certainly isn’t the only language family with metaprogramming facilities. C has a macro system that allows textual replacement as a preprocessing step at the start of compilation. C++ has a complex and powerful template metaprogramming feature that’s itself Turing-complete. Plenty of dynamic languages, like JavaScript, Python, and Ruby, have eval functions that acts on strings to produce a result. Ruby, in particular, has quite a few nice features, and Scala’s macro system even allows you to manipulate the parse tree! But here’s fair warning: once you’ve experienced Clojure’s macros, you may not want to go back.

You may notice that in this book, sometimes I’ll refer to Clojure, and sometimes to Lisp in general ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required