Fork me on GitHub
#clojuredesign-podcast
<
2023-10-19
>
neumann19:10:57

It’s new episode Thursday! In our latest episode, we wonder: must simple be simplistic? What is idiomatic composition? What does Clojure already know, and what do you have to teach it? https://clojuredesign.club/episode/095-composing-core/ Take a look and let us know what you think.

👍 2
Jason Bullers20:10:25

Good stuff 👍:skin-tone-2: one thing I still have a bit of trouble with is where/when/how to wrap up "units" of composition. I think I've got the hang of the "teach Clojure" part, and it's so nice and simple (and easy) to have these little, testable functions that work on a single input. Using them with the core functions gives a lot of power, as you noted. But then what tends to happen for me is that, since I'm just kind of plugging away with my repl, I end up with these long threading macros that take me from input to final result. It's really nice and easy to work with, and satisfying to get that result out the other side, but I don't think it's particularly readable in a future-proof sense. The piece missing I suppose is to chunk up the pipeline and then compose those chunks. I find trouble naming those pieces sometimes, though. And also, if the pipeline is being chunked, then I'm kind of back to working with aggregates again. Maybe the "trick" is to reduce the number of steps in the pipeline by leveraging transducers? I don't know. Does my problem make sense? I'll try and find an example.

Jason Bullers22:10:23

Here's an example: https://github.com/jbullers/advent_of_code/blob/main/src/advent2021/day05.clj Notice near the bottom there's chunky threading macros. I feel like these require a lot of brain cells to figure out when I come back to it

JR23:10:08

Wow, I had not heard of tap> before. Looks useful with println. I have the same issue trying to figure out what's coming through through a pipeline when reading code.