News for hackers. Stuff that matters.
Re:Currying in JavaScript by masklinn on Sunday September 19, 2021 @09:23AM (#28584140)
> every tool has its purpose.

That's really not true. The Y combinator is not generally useful for instance, because every modern language supports recursion.

> Currying is indispensable in some composability workflows.

It's not.

> Then you give each subcomponent a curried setter with the prop locked in.

That's partial application, not currying.

There are convenience use cases for libraries providing curried versions of some functions e.g. you might want to provide both `setModelProp(prop, val)` and `setModelProp(prop)(val)`. But that's because you expect significant use cases fo partially applied versions of the utility functions. Currying is not necessary for this, it just makes things more convenient for users.

Re:Currying in JavaScript by DemocracyFTW on Monday September 20, 2021 @05:12AM (#28591694)
> The Y combinator is not generally useful for instance

I wish I had been told that before trying to understand and actually use it. I once wrote a JS benchmark based on Rosetta code to compute Fibonacci numbers. Not only is the Y combinator code convoluted and quite hard to understand, it's also between 1e5...2e5 times slower than a plain iterative implementation.

Somehow I find it ironic to post such a result here.

Re:Currying in JavaScript by somehnacct3757 on Sunday September 19, 2021 @11:46AM (#28585258)
I see, I had these two concepts conflated. I guess the difference is currying returns a function and partial application invokes the function.

In that case I don't know any indispensible situations for currying.