Higher-order function: Difference between revisions

Content deleted Content added
Perl: "my ($f) = @_;" is wrong -- this way "twice" would call the specified function "$f" by passing also that same function to itself as one of its parameters.
Tag: Reverted
Perl: Actually, both variants work equally, therefore I will restore it as it were before.
Line 600:
 
sub twice {
my ($f) = shift @_;
sub {
$f->($f->(@_));
Line 623:
 
my $twice = sub {
my ($f) = shift @_;
sub {
$f->($f->(@_));