Re:Small functions to functionally augment ruby.
by teoryn on Friday September 09, 2011 @09:59AM
(#2978093)
Naive fibonacci is a much more interesting example for memoize than factorial:
[ Parent
| on HN ]
Re:Small functions to functionally augment ruby.
by irahul on Friday September 09, 2011 @10:27AM
(#2978209)
Yes. I added that to tests and README. Except that I have
fib = +lambda {|n| return n if n <= 1; fib[n-1] + fib[n-1] }
My fibonacci is 0, 1, 1, 2, 3.. and yours is 1, 1, 2, 3... but doesn't make a difference as far as example goes.