in reply to Re: Algorithm::Loops::NestedLoops and LCS sequence (prune)
in thread Algorithm::Loops::NestedLoops and LCS sequence

Ah, got it. I've modified the call to:

NestedLoops( [ ( sub { my $prefix = join '', @x[@_]; [ grep !$seen{$prefix . $x[$_]}++, ($_ ? $_ + 1 : @_) .. $#x ] +; } ) x $n, ], sub { my $ssx = join '', @x[@_]; $count += (matchss($ssx, $y) or return) * matchss($ssx, $x); }, );
.. and that's working fine; a dump of %seen confirms that it is seeing only genuine repeats.

Of course, now that I've unified the loop specifier, it feels slightly wasteful having to create $n copies of the same subref, but I can live with that. :)

Thanks for the help.

Hugo