I am trying to understand how currying works in functional programming. I have gone through wiki and a couple of questions about the same on SO.
Need help understanding lambda (currying)
I understand that currying is all about splitting a function that takes n arguments into n or less functions with one argument each. I theoretically comprehend it but I am not able to connect the dots while coding for the same. Perhaps it is my lack of knowledge in functional programming languages or C# (as many answers in the above questions deal with).
Anyway, I understand groovy & java. So I tried to get an outline for the standard add(a,b)
function in groovy but I couldn't finish it.
def closure = { arg ->
// ??
}
def add(anotherClosure , a){
return closure // ??
}
Can someone help me understand currying using groovy closures?