Split a character string based on change of character: Difference between revisions

m
(→‎{{header|Haskell}}: Added a variant expressed in terms of `span`)
Line 1,252:
charGroups :: String -> [String]
charGroups [] = []
charGroups (c : cs) = (c : xs) : charGroups ys
let (xs, ys) = span (c ==) cs
where
in (c : xs, ys) =: spancharGroups (c ==) csys
 
main :: IO ()
9,659

edits