Skip to content

Instantly share code, notes, and snippets.

@xentatt
Created May 14, 2013 06:18
Show Gist options
  • Save xentatt/5574047 to your computer and use it in GitHub Desktop.
Save xentatt/5574047 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
def multifunc(msg, pos, b)
puts "Calculating: #{msg}"
b.call(pos)
end
puts multifunc("Fibonacci numb", 5, f = lambda { |n| (n == 0 || n == 1) ? n : (f.call(n-1) + f.call(n-2)) })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment