Skip to content

Instantly share code, notes, and snippets.

@chrisbodhi
Last active September 13, 2021 19:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save chrisbodhi/c520bb6d9ad7185436f9f99cf5a3966f to your computer and use it in GitHub Desktop.
Save chrisbodhi/c520bb6d9ad7185436f9f99cf5a3966f to your computer and use it in GitHub Desktop.
"Recursion is the GOTO of functional programming." -- Erik Meijer
# "Recursion is the GOTO of functional programming." -- Erik Meijer
def fact(n):
return reduce(lambda x, y: x * y, range(1, n + 1))
print(fact(5))
# => 120
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment