Chapter 1Build a Solid Foundation

Over the course of this book you’re going to learn how and when to write macros in Clojure, but first you need to make sure the fundamentals are in place. In this chapter, you’ll see how reading, quoting, and macroexpansion work. Don’t worry—you won’t have to wait long before you get to write some simple macros. You’ll also see some built-in tools that Clojure provides developers for investigation when macros misbehave.

You don’t need a lot of setup to get started: just the REPL will do for now. If you don’t have Leiningen[7] installed, I suggest you go ahead and do that now, since it’s one of the easiest ways to use Clojure and comes with a nice REPL[8] built in. The examples in this book assume Clojure 1.6.0, ...

Get Mastering Clojure Macros now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.