Show HN: Function Currying like Haskell in Python
gist.github.com
gist.github.com
def add3(a):
def add2(b):
def add1(c):
return a+b+c
return add1
return add2
But this requires one to do add3(1)(2)(3). I figured it was possible to transform functions more mechanically. The builtin "partial" function is a class that merely collects args in a list, so one can't incrementally apply a few more args at once like a real curry. It's more of a fancy lambda closure.