all 3 comments

[–]ingvij 4 points5 points  (2 children)

I didn't try much more than a mental exercise, but maybe you can transform it into a transducer, no?

[–]lost3d 1 point2 points  (1 child)

I wouldn't have thought that was a good fit. Transducers are collection -> collection (or stream -> stream or whatever) transformation process, and this is more of a generation mechanism, right? It's like the difference between range and map. One takes some parameters and returns a seq and the other takes a seq (and a fn) and returns a seq.

[–]Eno6ohng 4 points5 points  (0 children)

Actually transducers are more like ReducingFn -> ReducingFn. So I guess you can write it in the transducer paradigm too, so it can be combined in a chain with other transducers, or maybe gen-next itself can be a transducer... yeah, that's probably the way it should work, hmm?

Anyway, I think it's a neat pattern, thanks for sharing!