Longest common prefix: Difference between revisions

Content added Content deleted
Line 20:
 
=={{header|Haskell}}==
<lang haskell>lcp :: (Eq a) => [String[a]] -> String[a]
lcp = map head . takeWhile allEqual . truncTranspose where
-- similar to transpose, but stops on end of shortest list