Skip to content

Instantly share code, notes, and snippets.

@Y4suyuki
Created March 21, 2013 10:13
Show Gist options
  • Save Y4suyuki/5211998 to your computer and use it in GitHub Desktop.
Save Y4suyuki/5211998 to your computer and use it in GitHub Desktop.
accumulator in Python
def f(x, y):
return x + y
def foo(f):
def nf(x, *args):
return x if not args else f(x, nf(*args))
return nf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment