Skip to content

Instantly share code, notes, and snippets.

@danazkari
Created July 30, 2014 16:23
Show Gist options
  • Save danazkari/88b703323fe7d70c01da to your computer and use it in GitHub Desktop.
Save danazkari/88b703323fe7d70c01da to your computer and use it in GitHub Desktop.
Programación funcional
# Fibonacci numbers, imperative style
# http://docs.python.org/2.7/tutorial/modules.html
def fibonacci(n, first = 0, second = 1):
for i in range(n):
yield first # Return current iteration
first, second = second, first + second
# Esto es programación funcional
print [ x for x in fibonacci(10) ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment