I\'m trying to implement the following function, but it keeps giving me the stack level too deep (SystemStackError) error.
stack level too deep (SystemStackError)
Any ideas what the problem mi
Here is something I came up with, I find this more straight forward.
def fib(n) n.times.each_with_object([0,1]) { |num, obj| obj << obj[-2] + obj[-1] } end fib(10)