Skip to content

Instantly share code, notes, and snippets.

Created Apr 6, 2021
What would you like to do?
Y combinator. Python lambda.
Y = lambda g: (lambda f: g(lambda arg: f(f)(arg))) (lambda f: g(lambda arg: f(f)(arg)))
if __name__ == "__main__":
fib = Y(lambda f: lambda n: (1 if n < 3 else f(n-1) + f(n-2)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment