What mysteries do Clojure macros hold? This course jumps right into macros with gusto. It starts with the key to understanding macros, takes you through the implementation of 6 progressively more complex macros, and finishes with the three reasons you *need* macros.
Screencasts, Whiteboards, and Slides produced to help you learn
Curated selections of courses on a specific topic
If you’re looking to watch absolutely all of the courses on this site, I’ve put together a suggested order. Start at the beginning and just watch everything straight through. Be sure to click those checkmarks to track your progress.
Parts of courses on specific topics
Do you understand the pattern of using helper functions within a macro and how it can make your macro more useful and easier to understand?
We add more compile-time optimizations and use tests to drive them.
We begin converting our Hiccup interpreter to a Hiccup compiler. That allows us to do compile-time optimizations.
People say you shouldn’t write a macro unless you need one. I don’t know if that’s true (it’s controversial in the Lisp world). But how do you know you need one?
Before we dive into our more complex macros, we equip ourselves with a powerful technique that focuses our mental powers on the data transformation at the heart of macros.
This is an experimental macro that I came up with. It makes a function that “wraps” a macro so that it can be used at runtime.
PDFs, code, and other downloads to help you learn
Have you ever wondered what the symbols in Clojure macros do? I’m talking about `, ~, ~@, etc. This handy reference sheet tells you what they all do, when to use it, and shows examples. Never get lost in a macro again!
When we’re developing macros, it really helps to be able to see what code it will output. Fortunately, Clojure comes with three built-in functions for doing just that. They are so useful for debugging. This reference sheet shows what each one does. It also includes how to access macroexpansion in the three most popular Clojure […]