Skip to content

Instantly share code, notes, and snippets.

@phorsfall
Created November 23, 2010 15:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phorsfall/711921 to your computer and use it in GitHub Desktop.
Save phorsfall/711921 to your computer and use it in GitHub Desktop.
# Also see: http://timeless.judofyr.net/tailin-ruby
# Requires Ruby 1.9:
fib = lambda do |i, n = 1, result = 0|
if i == -1
result
else
i, n, result = i - 1, n + result, n
redo
end
end
puts fib.call 10000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment