[Israel.pm] Exporting a Memoized function

Issac Goldstand margol at beamartyr.net
Thu Jun 27 02:48:04 PDT 2013


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
> 



More information about the Perl mailing list