3 ms·
Well, since functions are first class citizens nothing stops me from turning a (a,b,c) into a (a)(b)(c)
by domano 5y ago
Well, since functions are first class citizens nothing stops me from turning a (a,b,c) into a (a)(b)(c)
- jerf 5y agoSure, but nothing helps it either, and you're going to take a decent performance hit if you do that because you're turning one function call, possibly inlineable, into three that aren't going to inline, even with new Go generics you will not have enough power to write a "ToCurried" function that converts to a curried version at compile time (I think you could theoretically do it with reflect at runtime, but now you're taking an even bigger performance hit...) I would not normally say any language "support currying" just by having first-class functions. Python can do several of those things I said Go can't do and I still wouldn't call that "supporting currying". It sure isn't anything like the experience of using curry & uncurry in Haskell: https://hackage.haskell.org/package/base-4.15.0.0/docs/Prelude.html#v:curry https://hackage.haskell.org/package/base-4.15.0.0/docs/Prelu...
- domano 5y agoThanks, looking at it this way makes more sense!