I'm trying to refactor this function to be pointfree.
function siblings(me) {
return R.pipe(family, R.reject(equalsMe(me)))(me);
}
I'd like to pass me
to a function down the pipe along with the value that family
returns.
Tried a few things with R.useWith
or R.converge
with R.identity
or R.__
(not even sure if I should be using that) but found nothing to work.
If I understand correctly family
is a function that takes a person and returns a list of family members (including that person) e.g.
family(2);
//=> [1, 2, 3]
Then you want to create a function siblings
which takes a person and returns only their siblings e.g.
siblings(2);
//=> [1, 3]
Personally I think your function would read slightly better if it was written this way:
const siblings = me => reject(equals(me), family(me));
siblings(2);
//=> [1, 3]
If you really wanted a pointfree version of it, you could use converge
but I really don't think it is any better:
const siblings = converge(reject, [unary(equals), family]);