Re: memoizing a variable

2003-08-19 Thread Jenda Krynicky
From: "John W. Krahn" <[EMAIL PROTECTED]> > Robert Citek wrote: > > I want a variable to be memoized, that is, keep the variable > > available only to the function and the value remembered across > > invocations. So far, I have created two versions listed below, both > > of which "work." The firs

closure (was Re: memoizing a variable)

2003-08-18 Thread Robert Citek
At 04:18 PM 8/18/2003 -0700, John W. Krahn wrote: > ... it looks like you want a closure instead. > >{ # limit scope of $bar >my $bar = 100; >sub foo { ++$bar } >} Thanks for the example. I quess I do want closure. I'm not clear on how closure differs from memoizing. Regardless, this worked e

Re: memoizing a variable

2003-08-18 Thread John W. Krahn
Robert Citek wrote: > > Hello all, Hello, > I want a variable to be memoized, that is, keep the variable available only > to the function and the value remembered across invocations. So far, I > have created two versions listed below, both of which "work." The first > version prints a warning