[ABE.pm] HOP Q
Faber J. Fedor
faber at linuxnj.com
Wed Sep 27 16:30:56 PDT 2006
Ive been reading "Higher Order Perl" and I think I'm impressed; I'm
still fumbling around trying to apply the stuff.
However, there's one notation in his code examples that I don't grok.
Using the memoize-norm2 example in his book
(http://hop.perl.plover.com/Examples/memoize-norm2), he does this:
sub memoize {
my ($func, $keygen) = @_;
...
$cache{$key} = $func->(@_) unless exists $cache{$key};
...
}
where $func is a coderef.
I don't get the $func->(@_) call. Isn't that equivalent to
$func->($func, $keygen)? Not only does it not make sense (to me) to
pass a coderef to the code you're referencing, but I don't see where (if
at all) he modifies the original code being referenced to handle the
passed coderef.
Or am I completely off-base?
--
Regards,
Faber Fedor
President
Linux New Jersey, Inc.
908-320-0357
800-706-0701
http://www.linuxnj.com
More information about the ABE-pm
mailing list