[Israel.pm] Exporting a Memoized function

Gaal Yahas gaal at forum2.org
Thu Jun 27 04:26:29 PDT 2013


Wouldn't putting the call to memoize in a BEGIN block do the trick?


On Thu, Jun 27, 2013 at 12:48 PM, Issac Goldstand <margol at beamartyr.net>wrote:

> On 27/06/2013 12:44, Meir Guttman wrote:
> > Dear Shmuel,
> >
> >
> >
> >
> >
> > *From:*perl-bounces at perl.org.il [mailto:perl-bounces at perl.org.il] *On
> > Behalf Of *Shmuel Fomberg
> > *Sent:* יום ה27 יוני2013 12:26
> > *To:* Perl in Israel
> > *Subject:* [Israel.pm] Exporting a Memoized function
> >
> >
> >
> > Hi All.
> >
> >
> >
> > If I want to memorize a function:
> >
> >
> >
> > memoize('myfunc');
> >
> >
> >
> > A newbie’s (really) stupid question: what is “memorize” in a Perl
> > context? (Or is it a Perl issue?)
> >
> >
> >
>
> Memoizing is a way of caching the results of a deterministic and
> presumed expensive function, so it only runs the real function once (or
> once in a while) and otherwise saves the output of a given set of
> arguments in a cache and returns the cached answer when the inputs match.
>
> See http://en.wikipedia.org/wiki/Memoization
>
> > but I also want to export it. Is there anything that I need to worry
> about?
> >
> >
> >
> > What happen if I memoize the function *after* it was already exported?
> >
> > does the exported function points to the regular or to the memoized
> > function?
> >
> >
> >
> > Thanks,
> >
> > Shmuel.
> >
> >
> >
> > _______________________________________________
> > Perl mailing list
> > Perl at perl.org.il
> > http://mail.perl.org.il/mailman/listinfo/perl
> >
>
> _______________________________________________
> Perl mailing list
> Perl at perl.org.il
> http://mail.perl.org.il/mailman/listinfo/perl
>



-- 
Gaal Yahas <gaal at forum2.org>
http://gaal.livejournal.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.perl.org.il/pipermail/perl/attachments/20130627/ef50a657/attachment-0001.htm 


More information about the Perl mailing list