I have two curried functions f and g:
f: a -> b -> c
g: a -> c -> d
I want to create h:
h: a -> b -> d
Currently I'm composing them via pipe:
const h = a => pipe(f(a), g(a));
Is there a way to do this point free?
The reason why I ask is because I want to make the code as readable as possible. In some of my cases there are more that two functions that receive initial arguments in the composition and I'm trying to avoid repeatedly passing arguments.
I tried something like:
const h = converge(pipe, [f, g]);
which for some reason doesn't work. I guess I don't understand converge correctly.
Edit:
I tried what you suggested Ori Drori, but it doesn't work.
const modulo = divisor => dividend => dividend % divisor;
const maybeReduceByModulo = modulo => number =>
number >= 0 ? number : number + modulo;
export const maybeReducedModulo = flip(ap)(modulo, maybeReduceByModulo);
/**
* Before:
* export const maybeReducedModulo = divisor =>
* pipe(modulo(divisor), maybeReduceByModulo(divisor));
*/