Last active
January 23, 2019 07:29
-
-
Save manojmj92/7a7eaa8bd0aef7cfff9faa78670b293b to your computer and use it in GitHub Desktop.
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 = Enumerator.new do |sequence| | |
a = b = 1 | |
loop do | |
sequence << a | |
a, b = b, a + b | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment