Skip to content

Instantly share code, notes, and snippets.

@justinfay
Created August 9, 2016 13:46
Show Gist options
  • Save justinfay/9e929c83079f2a0a462edf8062d84f5e to your computer and use it in GitHub Desktop.
Save justinfay/9e929c83079f2a0a462edf8062d84f5e to your computer and use it in GitHub Desktop.
Simply curried functions in python
def curry(func, args=None):
args = args if args else []
def curried(arg):
args.append(arg)
try:
return func(*args)
except TypeError:
return curry(func, args)
curried.__name__ = "curry(%s)" % func.__name__
return curried
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment