Consider making compose binary: compose(f, g)

2
closed
davezuko
davezuko
Posted 5 years ago

Consider making compose binary: compose(f, g) #13

dogsGhost
dogsGhost
Created 5 years ago

What would be the advantage here?

davezuko
davezuko
Created 4 years ago

Nothing exceptional IMO, but it would simplify its signature and slightly improve the performance characteristics. Mathematical composition involves two functions, and this is emulated in many functional languages where compose is binary. If you compose more than two functions together, you should be composing compositions such as:

compose(f, compose(g, h))

It has the added benefit of making the syntax slightly more concise (vs. compose(f, g) vs. compose([f, g])) but I don't think I'm ready to sacrifice some of this utility just for mathematical correctness. Going to punt in this for now.