These are chat archives for ramda/ramda

21st
May 2016
Taylor Hurt
@thurt
May 21 2016 00:52
@jethrolarson Took me a little while to get the result using ap. The thing I was missing is to wrap each input list in an array. The problem I see here is that having two nested aps prevents one from doing point-free solution like @kedashoe 's right?
var input = [[1,2,3],[3,4,5]]
ap(ap([intersection, difference, flip(difference)], [input[0]]), [input[1]])
// [[3], [1, 2], [4, 5]]
Kevin Wallace
@kedashoe
May 21 2016 04:47
@thurt you can use reduce: http://goo.gl/CrtwFZ
Taylor Hurt
@thurt
May 21 2016 04:58
Wow interesting. Thank you i will look at this solution more closely tomorrow
Daniel Tsui
@sdtsui
May 21 2016 05:43
Hi everyone!
Lewis
@6ewis
May 21 2016 05:44
hi
Taylor Hurt
@thurt
May 21 2016 16:47
@kedashoe it looks like using useWith forces you to go thru a transformation step for each argument (even if that argument doesn't require a transformation). So you have to use identity (which could be considered data indirection)
I mean data indirection as "distracting" and "not ideal"
Denis Stoyanov
@xgrommx
May 21 2016 16:57
@thurt also you can use converge
This message was deleted
ram-bot
@ram-bot
May 21 2016 16:58
input is not defined
Denis Stoyanov
@xgrommx
May 21 2016 16:59
@ram-bot
const input = [[1,2,3],[3,4,5]];
R.converge(R.unapply(R.identity), [intersection, difference, flip(difference)])(...input)
ram-bot
@ram-bot
May 21 2016 16:59
[ [ 3 ], [ 1, 2 ], [ 4, 5 ] ]
Denis Stoyanov
@xgrommx
May 21 2016 17:04
@ram-bot
const input = [[1,2,3], [3,4,5]];
R.apply(R.converge(R.unapply(R.identity), [R.intersection, R.difference, R.flip(difference)]))(input)
ram-bot
@ram-bot
May 21 2016 17:04
[ [ 3 ], [ 1, 2 ], [ 4, 5 ] ]
Taylor Hurt
@thurt
May 21 2016 19:33
Nice! I think converge is a better semantic than reduce for this scenario
Kevin Wallace
@kedashoe
May 21 2016 20:00
agreed :) was just playing around with a point free approach that works with ap
Denis Stoyanov
@xgrommx
May 21 2016 23:12
Taylor Hurt
@thurt
May 21 2016 23:36
interesting that juxt is also very close to converge
Taylor Hurt
@thurt
May 21 2016 23:44
juxt is kind of a strange name. does it refer to scalar multiplication?
"Scalar multiplication
we can multiply a number (a.k.a. scalar) by a matrix by multiplying every
entry of the matrix by the scalar
this is denoted by juxtaposition or ·, with the scalar on the left..."