Fork me on GitHub
#clojure-dev
<
2016-09-19
>
ghadi03:09:01

https://gist.github.com/ghadishayban/f905be564d1d37ba9fa4d77b0d5e8848 A flexible generator facility, expressed functionally. Probably 80% of the way to yield. Examples at the bottom

ghadi04:09:15

It allows a lot of iterator like things to be written in a clear manner, so perhaps this of general interest. I'm curious to hear from people.

wagjo07:09:50

The produce! function is used in a completely different way in 2 arg and 3 arg version, yet it has the same name in the arglist. For me this is at least a very confusing interface, if not a poor design. I'd expected something simpler along the lines of how clojure.core.reducers/reduce handles the missing initial state.

ghadi15:09:54

Contrasting with c.c.reducers/reduce, the two arity version of this function doesn't have state it needs to discover for the initial call. This arity-2 variant here is explicitly stateful, like a #(.readLine rdr)