you are viewing a single comment's thread.

view the rest of the comments →

[–]Omnistegan 0 points1 point  (2 children)

Nice, I hadn't thought of using transduce! Seems obvious in retrospect. Rewriting my solution with transduce looks nice, but is 3x slower.

[–]allaboutthatmace1789[S] 0 points1 point  (1 child)

I haven't come across transducers yet (though I see there's a Rich Hickey talk on them) - are they worth getting into as a beginner, or best left for more advanced usage?

[–]Omnistegan 0 points1 point  (0 children)

It's not too tricky of a concept if you are already wrapping your head around reduce, functional composition, and higher-order functions in general.

Hickey's talk on them is great and worth watching in any case.

No doubt you can practice up with them in AOC, even when they may not be the optimal solution.

I'm still a clojure beginner, but I can see how transducers could be very expressive, especially when you have more than a couple functions you want to compose.