Anonymous user
Longest common prefix: Difference between revisions
→Perl 6: don't trim strings from the end, use lazy .ords instead
(→version 3: updated program and output to reflect latest task test cases additions) |
(→Perl 6: don't trim strings from the end, use lazy .ords instead) |
||
Line 199:
=={{header|Perl 6}}==
{{works with|rakudo|2015-03-26}}
<lang perl6>multi lcp() { '' }
multi lcp(
multi lcp(*@s) { substr @s[0], 0, first-index *.not, [Zeqv] |@s».ords;
}
|