My goal is to create a custom map function that first needs to filter the list to remain, for example, only even items before invoking the supplied function on every item. I do need the function to be curried and for the first parameter to be the function, not the list. I believe the signature would look like this:
(a -> b) -> [a] -> [b]
var isEven = x => x % 2 === 0;
var filterEvensMap = R.curry((fn, items) => R.map(fn, R.filter(isEven, items)));
filterEvensMap(R.negate, [1,2,3,4]); // [-2, -4]
var filterEvensMap = R.compose(
filterEvensMap = \fn items -> map fn (filter isEven items)
And it will give you a point-free equivalent:
filterEvensMap = (. filter isEven) . map
Then translate back to JS using Ramda:
var filterEvensMap = R.curry(R.compose(R.compose(R.filter(isEven)), R.map))
In your experience, does it matter?
I would go with the most readable expression, which in this case is probably the original expression. Point-free is fun and can add clarity in some places, but it can reduce readability considerably too, or at least level of understanding.