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

Chapter 4Evaluate Code in Context

So far you’ve seen the building blocks for writing macros, and you’ve learned why they aren’t the ideal solution for every problem. In the remainder of this book, we’ll look at several broad categories of macros to learn how you can clarify your code’s intentions, add your own control flow mechanisms, and take advantage of your other macro superpowers.

In this chapter, you’ll see macros that wrap the code they’re given into a new context for evaluating them. For example, you might want to evaluate a given expression with dynamic bindings, within a try/catch block, or where a resource is opened and then cleaned up. In this category of macros, you’re not doing anything too fancy with the input expressions—they’re ...

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