note
pKai
No idea what the desired output is (No ruby here).
<p>Making 1 change to the perl code, gives me 3 lines of
output:
<blockquote><code>24 = (3 * (5 - 6))
24 = (6 / (1 - (3 / 4)))
24 = ((5 - 6) * 3)</code></blockquote>
While the 1st and the 3rd line are junk the 2nd is at least one (the?) solution.
I got there by substituting the code construction (<c>sub {...}</c>) in the recursive
<c>poss2</c> call by a mere <c>$f</c>, reasoning that what is constructed as
<code>sub {
my($v3, $s3) = @_;
&$f($v3, $s3);
}</code>
just looks like a wrapper to the input sub.
<p>Does that help in any way?
<small>
<p><br/>Of course, I have to admit, I do not understand the algorithm (at the moment; but still trying to figure that part out), nor do I know ruby and can comment on your transforming the iterators ("<c>yield</c>") to perl closures :-/
<p>Hoping to learn more, when you resolve the case...
607551
607551