Skip to content

Instantly share code, notes, and snippets.

@sirpengi
Last active October 9, 2015 05:17
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save sirpengi/3443999 to your computer and use it in GitHub Desktop.
Save sirpengi/3443999 to your computer and use it in GitHub Desktop.
fizzbuzz
def Y(func):
def _(f):
return f(f)
def o(O):
def x(X):
return O(O)(X)
return func(x)
return _(o) # o_O
def fizzbuzz(c):
def fb(n, o):
def _fb(i):
return "" if i % n else o
return _fb
def f(n):
if not n:
return []
else:
return c(n - 1) + [(fb(3, "fizz")(n) + fb(5, "buzz")(n)) or n]
return f
f = Y(fizzbuzz)
print f(100)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment