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 6Build APIs That Say Just What They Mean

When we read code that’s more verbose than it needs to be, it slows us down. Ideally, we want code with only what’s necessary to communicate its purpose. In this chapter we’ll look at ways to provide beautiful APIs that allow developers to avoid including unnecessary boilerplate in their code. We’re not talking about APIs here in the HTTP web service sense, just the interface that a library or piece of code exposes to let you use it.

This goal may seem a bit hazy, since “beauty” is subjective, and easy-to-use pure-function APIs are already prevalent. The good news is that providing a succinct macro API doesn’t prevent you from offering an API with functions as well. I highly recommend this practice ...

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