Skip to content

Instantly share code, notes, and snippets.

@atg
Created December 25, 2009 23:55
Show Gist options
  • Save atg/263787 to your computer and use it in GitHub Desktop.
Save atg/263787 to your computer and use it in GitHub Desktop.
def fib
# The @ symbol denotes the arguments scope passed to the function
if @x == 0
@result(x: 0, {})
if @x == 1
@result(x: 1, {})
@result(x: fib(x: @x - 1, result: fib) + fib(x: @x - 2, result: fib), result: {})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment