Longest palindromic substrings: Difference between revisions
m
→{{header|Haskell}}
m (→{{header|Haskell}}: Tidied some if then else away) |
|||
Line 94:
<lang haskell>-------------- LONGEST PALINDROMIC SUBSTRINGS ------------
longestPalindromes :: String -> ([String], Int)
longestPalindromes s = go $ palindromes s
Line 112 ⟶ 111:
palindromicNuclei :: String -> [(String, (String, String))]
palindromicNuclei
concatMap go .
where
▲ prefixes = scanl (flip ((<>) . return)) [] s
go (a@(x:_), b@(h:y:ys)) =
if x == h
|