Skip to content

Instantly share code, notes, and snippets.

@shouichi
Created Dec 17, 2013
Embed
What would you like to do?
#!/usr/bin/env ruby
def fibgen
prev, curr = 0, 1
lambda do
temp = prev
prev = curr
curr += temp
temp
end
end
fib = fibgen
10.times { p fib.call }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment