From: Sean O'Halpin Date: 2005-10-17T23:22:08+09:00 Subject: Re: declaratively caching results of a method On 10/17/05, Brian Buckley wrote: > Can anyone provide the necessary snippet or otherwise advise or point > me to a solution to this? You could check out Daniel Berger's memoize (based on Nobu Nokada's original I think) on RAA (http://raa.ruby-lang.org/project/memoize/). Quoting from the project page: require "memoize" include Memoize # Inefficient fibonacci method def fib(n) return n if n < 2 fib(n-1) + fib(n-2) end fib(100) # Slow memoize(:fib) fib(100) # Fast Regards, Sean