Longest common suffix: Difference between revisions

Content added Content deleted
m (→‎{{header|Python}}: Named the allSame predicate)
m (→‎{{header|Python}}: Extended domain to empty and single-string lists.)
Line 361: Line 361:
def firstCharPrepended(s, cs):
def firstCharPrepended(s, cs):
return cs[0] + s
return cs[0] + s
return reduce(
return list(xs) if 2 > len(xs) else reduce(
firstCharPrepended,
firstCharPrepended,
takewhile(
takewhile(