>>20
Uh..
Here, check this perl code out. $fact contains an anonymous recursive function not using anything outside of its scope. $y_fact is the same thing only with Y.
my $fact=sub{
my($func,$arg)=@_;
return 1 if $arg==0;
return $arg*$func->($func,$arg-1)
};
my $y=sub{
my($func)=@_;
return sub{
return $func->($func,@_);
}
};
print $fact->($fact,5),"\n"; # prints 120
my $y_fact=$y->($fact);
print $y_fact->(5),"\n"; # prints 120, too. So much for Y combinator...
The only difference from paper someone linked to is that my function accepts two arguments at once while their accepts one and returns a function that accepts another one (but the dead dog taught us this is the same thing).