Jump to ratings and reviews
Rate this book

Mastering Clojure Macros: Write Cleaner, Faster, Smarter Code

Rate this book
Level up your skills by taking advantage of Clojure's powerful macro system. Macros make hard things possible and normal things easy. They can be tricky to use, and this book will help you deftly navigate the terrain. You'll discover how to write straightforward code that avoids duplication and clarifies your intentions. You'll learn how and why to write macros. You'll learn to recognize situations when using a macro would (and wouldn't!) be helpful. And you'll use macros to remove unnecessary code and build new language features.Clojure offers some sharp tools in its toolbox, and one of the sharpest is its macro system. This book will help you write macros using Clojure, and more importantly, recognize when you should be using macros in the first place.The Lisp "code-as-data" philosophy gives tremendous advantages to macro authors and users. You can use macros to evaluate code in other contexts, move computations to compile time, and create beautiful API layers. You don't need to wait on the Clojure language itself to add new features, you'll learn how to implement even the lowest-level features as macros. You'll step through representative samples of how to use macros in production libraries and applications, find clear details on how to construct macros, and learn pointers to avoid obstacles that often trip up macro amateurs.Clojure macros are more straightforward to use than metaprogramming features in many other languages, but they're different enough from normal programming to present challenges of their own. "Mastering Clojure Macros" examines some of these issues, along with alternatives to macros where they exist.By the time you finish this book, you'll be thinking like a macro professional.What You Need: The book examples have been developed under Clojure 1.6.0, although earlier and later versions of Clojure may work as well. You'll want to use Leiningen 2.x in order to follow along with the examples that use external projects.

122 pages, Paperback

First published August 26, 2014

14 people are currently reading
106 people want to read

About the author

Colin Jones

1 book103 followers

Ratings & Reviews

What do you think?
Rate this book

Friends & Following

Create a free account to discover what your friends think of this book!

Community Reviews

5 stars
14 (23%)
4 stars
25 (42%)
3 stars
19 (32%)
2 stars
1 (1%)
1 star
0 (0%)
Displaying 1 - 9 of 9 reviews
Profile Image for Eric Smith.
33 reviews2 followers
August 29, 2014
I laughed, I cried, I wrote some clojure macros.
Profile Image for Sam.
9 reviews7 followers
December 19, 2014
Excellent! A quick read and arms you with everything you need to start writing usable, maintainable, and _sane_ macros. Thanks, Colin!
2 reviews
April 28, 2020
The section on control flow was pretty mind bending. Enjoyed the read and learned a lot.
Profile Image for Pablo.
Author 1 book43 followers
July 5, 2019
The macro system is one of my favorite parts of Lisp but it's also very easy to get it wrong and paint yourself into a corner of ugly generated code. When I saw this book I got very excited.

The book is short and to the point. It's very informational dense. It covers learning what is a macro all the way to some advanced techniques you probably want to stay away from unless you know what you are doing and nothing else makes sense.

I'm glad the publisher had the guts to publish a short book. Normally short books are padded or dropped as people value page count and spines attract buyers. Books should be valued by what they add to your knowledge and I'm looking forward to reading more high value short books.
Displaying 1 - 9 of 9 reviews

Can't find what you're looking for?

Get help and learn more about the design.