Live data from Hacker News

Transducers for JavaScript

github.com

1–10 of 27 posts

Re: Transducers for JavaScript

#2
From: http://phuu.net/2014/08/31/csp-and-transducers.html

"To me, transducers are a generic and composable way to operate on a collection of values, producing a new value or new collection of new values. The word 'transducer' itself can be split into two parts that reflect this definition: 'transform' — to produce some value from another — and 'reducer' — to combine the values of a data structure to produce a new one."

Re: Transducers for JavaScript

#3
So I checked the definition of a transducer,but i'm not smart enough to get it. What the difference between that library and say lodash where I can bind and compose functions? because it seems like the same stuff

    var f=_.compose( _.partialRight(_.filter,isEven),_.partialRight(_.map,inc)) ;
or something.

Re: Transducers for JavaScript

#4
post #2

From: http://phuu.net/2014/08/31/csp-and-transducers.html "To me, transducers are a generic and composable way to operate on a collection of values, producing a new value or new collection of new values. The word 'transducer' itself can be split into two parts that reflect this definition: 'transform' — to produce some value from another — and 'reducer' — to combine the values of a data structure to produce a new one…

[deleted]

Re: Transducers for JavaScript

#5
post #3

So I checked the definition of a transducer,but i'm not smart enough to get it. What the difference between that library and say lodash where I can bind and compose functions? because it seems like the same stuff var f=_.compose( _.partialRight(_.filter,isEven),_.partialRight(_.map,inc)) ; or something.

I think it only iterates over the collection once.

Re: Transducers for JavaScript

#6
post #2

From: http://phuu.net/2014/08/31/csp-and-transducers.html "To me, transducers are a generic and composable way to operate on a collection of values, producing a new value or new collection of new values. The word 'transducer' itself can be split into two parts that reflect this definition: 'transform' — to produce some value from another — and 'reducer' — to combine the values of a data structure to produce a new one…

Amazingly, I was at the asyncjs.com presentation on these and related topics by that author just yesterday! Excellent stuff.

Re: Transducers for JavaScript

#7
post #5
post #3

So I checked the definition of a transducer,but i'm not smart enough to get it. What the difference between that library and say lodash where I can bind and compose functions? because it seems like the same stuff var f=_.compose( _.partialRight(_.filter,isEven),_.partialRight(_.map,inc)) ; or something.

I think it only iterates over the collection once.

That and they're collection agnostic. I highly recommend watching Rich Hickey's talk for more background: https://www.youtube.com/watch?v=6mTbuzafcII

Re: Transducers for JavaScript

#8
post #3

So I checked the definition of a transducer,but i'm not smart enough to get it. What the difference between that library and say lodash where I can bind and compose functions? because it seems like the same stuff var f=_.compose( _.partialRight(_.filter,isEven),_.partialRight(_.map,inc)) ; or something.

[deleted]

Re: Transducers for JavaScript

#10
post #5
post #3

So I checked the definition of a transducer,but i'm not smart enough to get it. What the difference between that library and say lodash where I can bind and compose functions? because it seems like the same stuff var f=_.compose( _.partialRight(_.filter,isEven),_.partialRight(_.map,inc)) ; or something.

I think it only iterates over the collection once.

Then what happens to operations that access the collection? like third argument in JavaScript's native forEach?
Post reply on HN