How to Read This Book

There are lots of code examples in this book, and I suggest trying them out in your own REPL, creating a toy project for the longer examples. Leiningen[3] is the Clojure build tool of choice, and lein new macrobook will give you a new project to play around in. The examples in this book have been tested using Clojure 1.6.0, so you’re safest using that version of Clojure when you try things out. But since the macro system changes so rarely, I anticipate that many earlier and future versions will work just fine as well.

This book is intended to be read front to back, but if you’re the adventurous or time-constrained sort, here are a few ideas to get you the information you’re looking for:

The first two chapters, Chapter 1, Build a Solid Foundation and Chapter 2, Advance Your Macro Techniques, teach you all the building blocks you’ll need to write your own macros. If you already have a pretty good working knowledge of macros and have written and debugged several of them yourself, you may wish to skip straight to Chapter 2, Advance Your Macro Techniques.

Everyone should read Chapter 3, Use Your Powers Wisely, where you’ll see some of the problems that macros can cause and why you don’t want to use them all the time.

In the remaining chapters, starting with Chapter 4, Evaluate Code in Context, we’ll look in depth at some use cases for macros, with examples from both the Clojure language itself and community libraries. In these chapters, you’ll see reasons you’d use macros in practice, despite their imperfections, and sometimes you’ll see ways to accomplish the same goals with normal functions.

It’s fine to skip around once you’ve finished Chapter 3, Use Your Powers Wisely. By that point you’ll have all the basic tools you need to understand the rest of the book. The macros you see will generally get more complex as the chapters progress, but there are minimal dependencies among the later chapters.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.142.255.140