| Next | You can't get there from here | 25 |
First let's see some wrong answers.
What's wrong with this?
sub halts {
my ($source_code, $input) = @_;
my $function = eval $source_code;
$function->($input);
# I guess it halted!
return 1;
}
It doesn't always produce an answer
If that were allowed, this would be a simpler solution:
sub halts {
my ($source_code, $input) = @_;
1 while 1; # Har har har
}
| Next | ![]() |
Copyright © 2005 M. J. Dominus |