

Show HN: Function Currying like Haskell in Python - gamegoblin
https://gist.github.com/grantslatton/9221084

======
gamegoblin
I hacked this together today after seeing something like:

    
    
      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.

