dvdzkwsk / redash

Tiny functional programming suite for JavaScript.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Consider making compose binary: compose(f, g)

dvdzkwsk opened this issue · comments

What would be the advantage here?

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.