These are chat archives for ramda/ramda

20th
May 2016
Taylor Hurt
@thurt
May 20 2016 17:36
Is there someway I could do this in a point-free manner?
function intersectionAndDiffs([list1, list2]) {
  return [intersection(list1)(list2), difference(list1)(list2), difference(list2)(list1)]
}
Taylor Hurt
@thurt
May 20 2016 17:44
My initial thought is that I would need a special Tuple type in order to work with 2 values at the same time in point-free manner?
Vladimir Starkov
@iamstarkov
May 20 2016 17:57
const intersectionAndDiffs = R.ap([
  intersection,
  difference,
  R.flip(difference)
]);
/cc @thurt
Taylor Hurt
@thurt
May 20 2016 17:58
Thank you @iamstarkov ! I wa starting to get there
[intersection, difference, flip(difference)]
Taylor Hurt
@thurt
May 20 2016 18:15
This doesn't seem to work ? http://goo.gl/rlkOEm
Jethro Larson
@jethrolarson
May 20 2016 18:20
If the functions are binary you end up with functions in the resulting array
Taylor Hurt
@thurt
May 20 2016 18:22
so i need to apply the first input list and then apply the second input list?
Jethro Larson
@jethrolarson
May 20 2016 18:23
you're trying to compose the functions right?
removing the console.log will show you what you're actually getting
Taylor Hurt
@thurt
May 20 2016 18:24
i see, your right, a list of functions
Kevin Wallace
@kedashoe
May 20 2016 18:26
does this work? http://goo.gl/t2RqIv
Taylor Hurt
@thurt
May 20 2016 18:27
sure does! never seen juxt before
Kevin Wallace
@kedashoe
May 20 2016 18:28
for me i find juxt easier to use than ap when working with arrays as the final input
Taylor Hurt
@thurt
May 20 2016 18:29
nice, thanks for the idea. I will have to study it a little more
Jethro Larson
@jethrolarson
May 20 2016 18:33
Yeah, ap is more useful for other types like future/maybe/etc
Jethro Larson
@jethrolarson
May 20 2016 18:39
also
lift(fn, [1], [2])
is the same as
ap(ap([fn], [1]), [2])
Vladimir Starkov
@iamstarkov
May 20 2016 21:12
@thurt @jethrolarson @kedashoe yeah, remaining part is you have to R.apply every function in input array