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

Implementing Pattern Matching

If you’ve ever programmed in a functional style outside of Clojure, perhaps using Haskell, Erlang, or Scala, you’ve almost certainly seen pattern matching. You can think of pattern matching as similar to Clojure’s destructuring feature. It allows you to pull apart input expressions and bind values to names wherever you want. But pattern matching actually goes a bit further than destructuring as it lets you provide several potential patterns to match, along with clauses that will be executed if there’s a match.

So if you’re a pattern matching fan coming to Clojure, what do you do? If you immediately thought, “I could write a macro!,” you’re more optimistic about your macro skills than I was when I learned about pattern ...

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