Process collections in Clojure: map, reduce, threading
12 steps · about 3 h 55 min · Beginner
- Core Functions in Depth (article, Clojure for the Brave and True, 40 min)
It starts with the sequence abstraction and shows map and reduce on real data, which is the base for everything after.
- Clojure Guides: Language: Collections and Sequences (guide, clojure-doc.org, 25 min)
It covers filter, remove, take, drop and laziness, so you have the full set of sequence tools before you chain them.
- Clojure Brave Chapter 4 - Nextjournal (tutorial, Nextjournal, 20 min)
The map and reduce examples here are runnable, so you can check how each result comes out.
- Recurse Center: Week Two (blog, otee.dev, 15 min)
Implementing map and filter with reduce shows what reduce does underneath.
- 'Threading' a Pedagogical Needle (part 2) (blog, Michael Whatcott, 10 min)
It walks from let to as-> to ->>, which makes threading macros easy to understand before you meet the formal rules.
- 'Threading' a Pedagogical Needle (part 1) (blog, Michael Whatcott, 10 min)
It explains the common mental hurdle of picturing the value being threaded through each form.
- Clojure - Threading Macros Guide (guide, clojure.org, 20 min)
The official guide settles when to use ->, ->>, as->, and some->.
- Threading macros in clojure (blog, nilenso, 10 min)
It gives practice refactoring nested map and reduce calls into thread-last pipelines.
- clojure-site/content/guides/faq.adoc (doc, clojure.org (GitHub), 15 min)
It explains why sequence pipelines build intermediate sequences and when into with transducers is a better choice.
- Clojure - Transducers (reference, clojure.org, 25 min)
It is the official definition of transducers, built on reducing functions and comp.
- Clojure for the Really Brave: From Reductions to Transducers (blog, Jörg Volbers, 25 min)
It builds a transducer step by step from a plain reduce, which connects what you learned about reduce to transducers.
- Using transducers (blog, Andrey Listopadov, 20 min)
It ends with practical advice on choosing between lazy ->> pipelines and transducers.