These are chat archives for ramda/ramda

27th
Sep 2018
Asad Saeeduddin
@masaeedu
Sep 27 2018 00:52
Is it possible to specify a monoid in Ramda?
The way I would solve @joeyfigaro's problem would be to fold the array of objects using a monoid that behaves as desired
Johnny Hauser
@m59peacemaker
Sep 27 2018 02:36
What talk?
Johnny Hauser
@m59peacemaker
Sep 27 2018 03:08
LOL, I scrolled back forever looking for it
Thanks
Johan Codinha
@JohanCodinha
Sep 27 2018 07:46
@outluch You might need to draw out the flow of your data for your own understanding.
Look up the converge function it will help you when one piece of data is needed in multiple function.
Aaron Rice
@adrice727
Sep 27 2018 16:37

I'm missing something in regards to transduce. An example:

const isEven = x => x % 2 === 0;
const timesThree = x => x * 3;
const addOne = x => x + 1;

// Works as expected
R.transduce(R.compose(R.filter(isEven), R.map(times3)), R.flip(R.append), [], R.range(1,8)) //  [ 6, 12, 18 ] 

// ???
R.transduce(R.compose(R.map(addOne), R.filter(isEven), R.map(times3)), R.flip(R.append), [], R.range(1,8)) // [ 6, 12, 18, 24 ]

Why am I not getting the same result as I do when I call:

R.compose(R.map(addOne), R.filter(isEven), R.map(timesThree))(R.range(1,8)) // [ 7, 13, 19 ]

?

Brad Compton (he/him)
@Bradcomp
Sep 27 2018 16:39
ramda/ramda#2206 might help
Aaron Rice
@adrice727
Sep 27 2018 16:45
@Bradcomp Yes, it does. I can just use pipe. I don't understand the motivation though. I guess I'll have to take a look at the clojure docs. Thanks!