This morning I wrote some code which looked like:
(reduce (fn [acc x] (reduce (fn [acc y] (reduce f acc y)) acc x)) init xs)
(it was slightly more complex with some filtering and destructuring thrown in for good measure).
I wasn’t happy with those nested reduces and it occured to me that I could refactor it to use a single one:
(reduce f init (for [x xs, y x, z y] z))
Now that reads better!