Created
July 30, 2014 16:23
-
-
Save danazkari/88b703323fe7d70c01da to your computer and use it in GitHub Desktop.
Programación funcional
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
# 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