I doubt I can answer this as clearly as Rich or others but...

I think the answer to this lies in the fact that composing transducers is 
composing reducer-transformers not reducer functions themselves.

When composing reducer-transformers, the result is another transformer. 
 When this new transformer is actually applied to a reducer function that 
reducer function is augmented with the composed transformer's functionality 
from the outside in so to speak.  So if a,b, and c are transducers and we 
can create a new one abc via (comp a b c).  In order to do something useful 
with that we must apply it to a reducer function so we could do (abc 
identity), which, would yield a reducer function that, during a reduce, 
would do a then b then c then identity to each value - outside in.

So, the transducers are composed just like any other functions but when 
they're actually used, their logic seems to work left to right.

It reminds me somewhat of the way monad transformers work in Haskell (my 
not-totally-fluent-knowledge) where each monad transformer augments the 
existing monad with new monad functionality.  The original monad becomes 
the "inner" monad and the transformer's logic gets wrapped on top of the 
inner monad.

/stt

On Thursday, August 7, 2014 8:24:52 PM UTC-4, puzzler wrote:
>
> I'm also curious to understand how the underlying implementation of 
> transducers leads function composition to behave in the reverse order of 
> ordinary function composition.
>
>
> On Thu, Aug 7, 2014 at 8:07 AM, <vve...@gmail.com <javascript:>> wrote:
>
>> Hello, what is the reason for comp to produce two different orderings 
>> depending on whether it composes partials or transducers?
>>
>> (comp (partial filter even?) (partial map (partial + 1)))
>> (comp (filter even?) (map (partial + 1)))
>>
>> Wouldn't it be more intuitive for upcoming clojurians to have both 
>> cases exhibit the same execution order?
>>
>>
>> On Wednesday, August 6, 2014 8:01:24 PM UTC+2, Rich Hickey wrote:
>>
>>> I pushed today the initial work on transducers. I describe transducers 
>>> briefly in this blog post: 
>>>
>>> http://blog.cognitect.com/blog/2014/8/6/transducers-are-coming 
>>>
>>> This work builds on the work done for reducers, bringing 
>>> context-independent mapping, filtering etc to other areas, such as 
>>> core.async. 
>>>
>>> This is work in progress. We will be cutting alpha releases to help make 
>>> it easier to start using core's transducers together with core.async's new 
>>> support for them. 
>>>
>>> I am very excited about this powerful technique and how we all might use 
>>> it. 
>>>
>>> Please have a look. 
>>>
>>> Feedback welcome, 
>>>
>>> Rich 
>>>
>>>  -- 
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@googlegroups.com 
>> <javascript:>
>> Note that posts from new members are moderated - please be patient with 
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+u...@googlegroups.com <javascript:>
>> 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+u...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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