Hacker News new | ask | show | jobs
by senderista 19 days ago
And that's fine, because currying forces you into impossible tradeoffs when choosing argument order.
2 comments

Ymmv, but you can get pretty far with a convention: order arguments by _how likely they are to be closed_ within any given context. As a full-time F# developer that covered >95% of what we were doing.

An alternative is providing variations on a function that "bundle" sets of arguments, and then making the bundle the first parameter, but that only makes sense when the "bundles" occur together a lot.

I would rather see syntax to make partial application on arbitrary named or positional slots as ergonomic as possible. How much has that been explored by existing languages?
What I've seen: (A) anonymous functions with placeholders (see above), (B) currying (ML), (C) binding variations defined with the function itself (Scala, I think?).

One approach that I haven't seen yet (maybe some language has it?) is named bindings for arbitrary partial application. I _think_ that would be a little tighter than anonymous functions, but I'd need to see it in action.

But Haskell has nice little functions for switching argument order, and people can easily make them in other currying languages.