What should an lcss() routine return?
That is precisely the cause of my aforementioned ice cream headache. I agree that the answer depends on the specific requirements of the end user.
where to go from here?
My original goal from about a week ago was to improve the existing CPAN String::LCSS module. There is no dispute that it has a bug; it returns the wrong answer for some reasonable pairs of input strings. For example, given the 2 input strings, "abc" and "abcd", it should return "abc" as the longest common substring. But it returns undef, meaning that it did not find a common substring. That is why I attached a patch for that module. Your brute code fixes that bug and the other undisputed bugs reported against it. This is the simple case where there is only one longest common substring.

The separate issue arises when there are multiple longest common substrings. I don't know what the behavior should be in this case. However, the module documentation should explicitly state the behavior in this case. All the related CPAN modules lack sufficient detail in their POD.

I still plan to forge ahead with the arduous process of contacting the author of String::LCSS to either upload something new or grant co-maintainership.

UPDATE: 2016 jan 1, I was grant co-maintainership, and I uploaded String::LCSS version 1.00 which fixes these bugs.


In reply to Re^9: A better implementation of LCSS? (What should a Longest Common Substring function return?) by toolic
in thread A better implementation of LCSS? by BrowserUk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.