4 ms·
Lisps are great to challenge your thinking, but (with Clojure) I got stuck at making sense of macros — way out of my depth at that moment in time.
by barrenko 2y ago
Lisps are great to challenge your thinking, but (with Clojure) I got stuck at making sense of macros — way out of my depth at that moment in time.
- Jtsummers 2y agoI'd recommend studying some existing macros and spending time recreating them. Starting with simple use-cases of the macro and working up. Repeat this with a few macros and you'll eventually learn how they operate. Let Over Lambda is also a good (opinionated) book on macros (most of the book is available for free), and of course there's PG's On Lisp (jump to page 95 in the PDF if you're already comfortable with Lisp). https://letoverlambda.com/index.cl/toc https://letoverlambda.com/index.cl/toc https://paulgraham.com/onlisp.html https://paulgraham.com/onlisp.html
- barrenko 2y agoThank you!
- iLemming 2y ago> I got stuck at making sense of macros Are you simply staring intently at the macros, trying to make sense of them, or are you actually utilizing the macro-expanding feature in your editor? Or perhaps you're grappling with writing macros yourself? Macros can be tricky, which is why Clojurists often avoid creating new ones unless there's a compelling reason to do so. There's an old book called "Mastering Clojure macros", it's tiny - fewer that a hundred pages. It helped me back when I was learning Clojure.
- barrenko 2y agomore trying to understand really, this blew my mind at a time https://aphyr.com/posts/305-clojure-from-the-ground-up-macros https://aphyr.com/posts/305-clojure-from-the-ground-up-macro...