in reply to Number from given digits puzzle
It turns out that there were three bugs in the code. Two are simple: a plus sign instead of a dot, as mentioned in Re^2: Number from given digits puzzle, and swapping two variables in the same line, as in Re^3: Number from given digits puzzle. The third problem however seems to be a bug in the perl interpreter about handling closures. They say that the bug is fixed from perl 5.9.0.
Just mentioning a variable at the right point like this makes the problem disappear:
poss(mask($v, $m), mask($s, $m), sub { my $unused = $f; # <------ my($v1, $s1) = @_; for my $k (0 .. @vv2 - 1) { poss2($v1, $vv2[$k], $s1, $ss2[$k], sub { my($v3, $s3) = @_; &$f($v3, $s3); }); } });
|
|---|