code-reviews

phronmophobic 2020-09-26T16:14:51.001800Z

hopefully it's not too late for feedback: • the transducers in clojure.core use volatile! or ArrayList for state. see partition-all • the transducers that accumulate state (like partition-all implement the completion arity to flush the state at the end. in your examples, it looks like the last bucket doesn't make it to the output

phronmophobic 2020-09-26T16:20:53.002Z

personally, I would probably implement bucket as a composition of partition-by and map.

2020-09-26T16:42:22.002200Z

Never too late for feedback 🙂 Yeah I'm aware of the arraylist/volitile thing. I assume those are mainly performance optimizations that I haven't need yet but would probably switch to at some point. The thing that makes partition-by insufficient is that the parts require accumulating state rather than just checking the single input. for example if I have a stream of integers and want to break them into partitions where the sum of each partition is 10.

phronmophobic 2020-09-26T16:43:18.002400Z

ohhh, that makes sense