Created
June 1, 2015 19:14
-
-
Save defHLT/0fefa04a9a60319172e5 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
fib = Enumerator.new do |y| | |
a, b = 0, 1 | |
loop do | |
y.yield a | |
a, b = b, a + b | |
end | |
end | |
p fib.take 25 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment