I think you are referring to this 
article: 
http://clojure.com/blog/2012/05/08/reducers-a-library-and-model-for-collection-processing.html

What Rich means with a collection to "reduce itself" is using the internal 
reduce implementation tied to the collection. E. g. using reduce with 
(clojure.core/map inc coll) uses a reduce implementation depending on coll. 

To address your other question, whether the resulting sequence is created 
using cons, conj: 
1. The result must not necessarily be a sequence. Consider (reduce + ...)
2. Cons, conj etc. are eliminated from between the transformation steps. 
Consider (r/filter even? (r/map inc [1 2 3 4])): No sequence after map, no 
cons/conj.

Reducers bring to the table that they provide the same semantics of 
ordinary transformation functions but take and produce reducibles that are 
seperated from order, laziness and representation of the result. They do it 
by relying on the reducibility of collections instead of their 
sequentiabilty and using transducers internally. E. g. the elimination of 
order allows for parallel fork/join based transformation.



On Wednesday, September 24, 2014 4:30:31 PM UTC+2, Hussein B. wrote:
>
> To elaborate more,
> I know that with reducers, map for example isn't going to create the 
> resulting sequence by using cons. That is clear to me.
> But, if the collections is going to call cons while reducing itself, then 
> I'm not sure what is the benefit of reducers (besides it makes sense and 
> makes a nice abstraction).
>
> Thanks.
>
> On Wednesday, September 24, 2014 2:58:18 PM UTC+2, Aleš Roubíček wrote:
>>
>> Resulting function is passed to reduction function as an recipe, how to 
>> process the data. Collections implements CollReduce protocol. When you call 
>> reduce function it will delegate the work to concrete implementation of the 
>> protocol.
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to