tjmehta/101

Infinite Compose

thejsj opened this issue · 4 comments

It's be awesome if compose took an unlimited amount of arguments. Is there a reason this is not the case? (Could help out with a PR if no one objects) @tjmehta

$ node
> var compose = require('101/compose')
undefined
> var plusOne = (x) => x + 1
undefined
> compose(plusOne, plusOne, plusOne)(1)
3
> compose(plusOne, plusOne, plusOne, plusOne)(1)
3

So far I've designed methods like 'compose' to work with two args so that they work with 'Array.reduce'. I am not opposed to making it work with infinite args, however I would like it to continue working with 'reduce'. If 'reduce' works for you for now, let's close this off. If someone submits a PR that makes it work both ways I will accept it.

@tjmehta I'm a bit confused, in your reply you said that you'd be willing to look at a PR, but more than a year before you wrote that you declined #56, which seems to make it work both ways. So is this functionality welcome or not?

TBH a year later, I probably didn't remember somebody already tried to add this, and I don't feel strongly about either way..

Maybe I thought since two ppl had suggested the same thing it was worth revisiting the idea 🤷‍♂️