in reply to Number from given digits puzzle
No idea what the desired output is (No ruby here).
Making 1 change to the perl code, gives me 3 lines of output:
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 (sub {...}) in the recursive poss2 call by a mere $f, reasoning that what is constructed as24 = (3 * (5 - 6)) 24 = (6 / (1 - (3 / 4))) 24 = ((5 - 6) * 3)
just looks like a wrapper to the input sub.sub { my($v3, $s3) = @_; &$f($v3, $s3); }
Does that help in any way?
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 ("yield") to perl closures :-/
Hoping to learn more, when you resolve the case...
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Number from given digits puzzle
by ambrus (Abbot) on Mar 31, 2007 at 11:36 UTC | |
by Krambambuli (Curate) on Mar 31, 2007 at 12:36 UTC | |
by ambrus (Abbot) on Mar 31, 2007 at 12:54 UTC |
In Section
Seekers of Perl Wisdom