lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


>This is my first stab at lua programming. And I have not studied the
>available documantation all that much. I wonder if there is an elegant
>way of of memoizing functions. My first try is this:

See lua/test/fib.lua . It includes a generic function that caches the values
of arbitrary (one-arg/one-result) functions and is applied to the fibonacci
function.
--lhf