> return in a block returns from the function containing the block. The
> return value of a block call is the value of the last statement. Just
> erase the word "return" from your block.

and

> $arg = []
>
> def remember(func)
>    Proc.new { |n| $arg[n] ||= method(func).call(n) }
> end


Ok, it work. Thanks.

But i've still have a problem.
When the function is recursive (like fibonnacci is) it doesn't work has
expected.
Only the first value is memorized (if i call fib(10), only the value for
n=10 and not n<10).
The first call is the new function but the new function call the old one so
i'm still in O(2^n).

What is the solution ?

Regards