2 ms·
Yes, closures can be used to achieve a similar effect to currying. That said, they only work with functions you create yourself. If baseFun came from a library,
by icebraining 9y ago
Yes, closures can be used to achieve a similar effect to currying. That said, they only work with functions you create yourself. If baseFun came from a library, you'd have to write an extra function just to close over baseUrl.
Of course, one can wonder how many times can one usefully curry with external functions, but I think that's partially a result of not having currying syntax in the first place. For example, the fact that Ruby has blocks massively influences the typical design of its libraries, when compared to Python.