Open RobertDober opened 9 years ago
Moved from lab42_core
Aiding the simple memoization pattern ```ruby def fibo n @__fibo__ ||= {} @__fibo__[n] ||= n < 2 ? n : fibo(n-1) + fibo(n-2) end
declare like this
def fibo n; n < 2 ? n : fibo(n-1) + fibo(n-2) end memoize :fibo # Can I find the param here in memoize?
Alternatively
defmemo :fibo do |n| n < 2 ? n : fibo(n-1) + fibo(n-2) end end
Then we could have tools like
clear_memo_cache :all clear_memo_cache for: :fibo #...
this is in core now
Moved from lab42_core
declare like this
Alternatively
Then we could have tools like