[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Memoizing Functions - yet another attempt
- From: Petite Abeille <petite.abeille@...>
- Date: Sat, 14 Dec 2013 23:15:52 +0100
On Dec 14, 2013, at 11:07 PM, Andrew Starks <andrew.starks@trms.com> wrote:
> The argument list is:
>
> function(k, ...)
>
> So, it only memoizes on the first argument but accepts many. There must be a general use case for this, but it isn't clear to me what that would be.
Nah, just confusion. One parameter is all it takes. The vargs could as well not be there.
local k = 0
f = memoize(function( ... ) print( 'args', select( '#', ... ) ) k = k + 1 return k end)
f( 1, 2, 3 )
> args 1