Re:Rich Hickey – Inside Transducers [video]
by ajuc on Friday November 21, 2014 @07:53AM
(#8641010)
For me the "ephiphany" was when I realized reduce don't need to be (T,T)->T, but can be (T1, T2) -> T1.
[ Parent
| on HN ]
Re:Rich Hickey – Inside Transducers [video]
by dkersten on Friday November 21, 2014 @11:35AM
(#8641978)
They can also be (T1,T2)->T3
Not really?
When you reduce with function f(T1, T2) -> T3 the result of previous iteration becomes first argument for the next iteration, so they must be of the same "type".
Or am I missing something?
Re:Rich Hickey – Inside Transducers [video]
by dkersten on Sunday November 23, 2014 @06:24AM
(#8648470)
Ah, no, you're right.
I was thinking that mapping can be f(T1)->T2 and how reducing can change types too, but I guess I wasn't paying enough attention because of course the reduce signature is f(accumulator, input) and the output is accumulator, so yea, you're absolutely right: f(T1,T2)->T1