Re: Understanding `clojure.core.reducers/rfn`

2017-05-19 Thread Tianxiang Xiong
OK, so would you say it's *not* good practice to do: (r/reducer [1 2 3] (map f)) instead of (r/map f [1 2 3]) because the former doesn't create a reducer that handles kv-reduction? If so, it seems that `folder`/`reducer` are not fns intended for public consumption, since `rfn` is private an

Re: Understanding `clojure.core.reducers/rfn`

2017-05-19 Thread Alex Miller
This is a place where reducers and transducers diverge. Transducers don't have support for automatic kv reducing (there are some tricky details as to why this was possible in reducers but not as easy in transducers, which I mostly don't remember at this point). That is an area of possible future

Re: Understanding `clojure.core.reducers/rfn`

2017-05-18 Thread Tianxiang Xiong
I think this is one of those cases where I need to see an example to understand. >From what I can tell, the `(fn [f1] (rfn ...))` argument to `folder` is a reducing-function-transformer--i.e. transducer, except there are some differences in things like order of application in composition. I *do

Re: Understanding `clojure.core.reducers/rfn`

2017-05-18 Thread Alex Miller
Reducers combine functionally, so they all have to support it to create any composite reducer that contains map. On Thursday, May 18, 2017 at 10:11:23 PM UTC-5, Tianxiang Xiong wrote: > > Would that ever be the case for `r/map`? Or does it only apply to certain > other reducers? > > On Thursday,

Re: Understanding `clojure.core.reducers/rfn`

2017-05-18 Thread Tianxiang Xiong
Would that ever be the case for `r/map`? Or does it only apply to certain other reducers? On Thursday, May 18, 2017 at 4:11:39 PM UTC-7, Alex Miller wrote: > > The 3 arity is used when reducing over a map, like reduce-kv. Reducers do > this automatically which varies from the core reduce. -- Y