Last active
October 9, 2015 05:17
-
-
Save sirpengi/3443999 to your computer and use it in GitHub Desktop.
fizzbuzz
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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