Get the latest tech news
Clojure macros continue to surprise me
have two modes: avoid them at all costs/do very basic stuff, or go absolutely crazy. Here’s the problem: I’m working on Humble UI’s component library, and I wanted to document it.
Clojure macros have two modes: avoid them at all costs/do very basic stuff, or go absolutely crazy. Unfortunately, this approach reformats code: while in the macro, all we have is an already parsed AST (data structures only, no whitespaces) and we have to pretty-print it from scratch, adding indents and newlines. You’d need a parser, a build step... Here—just ten lines of code, on vanilla language, no tooling or setup required.
Or read this on Hacker News