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 ...

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.