++ed by:
JGAMBLE RPAVLOV

2 PAUSE users
1 non-PAUSE user.

Christian Jaeger
and 1 contributors

NAME

FP::Memoizing - a functional memoize

SYNOPSIS

 use FP::Memoizing qw(memoizing memoizing_to_dir);
 use Chj::tempdir;
 my $tmp= do{ mkdir ".tmp"; tempdir ".tmp/" };

 my $count=0;
 sub f { $count++; $_[0] * 5 }

 *fm= memoizing *f; # memoize in process memory
 *fm2= memoizing_to_dir $tmp, *f; # memoize to files in ".foo/"

 is fm(3), 15;
 is $count, 1;
 is fm(3), 15;
 is $count, 1;
 is fm(2), 10;
 is $count, 2;
 is fm2(3), 15;
 is $count, 3;
 is fm2(3), 15;
 is $count, 3;

DESCRIPTION

TODO

No locking whatsoever is currently being done.

Also, serializes twice in different ways, for the key and the actual storage. Could Storable be used for the key as well?