Determine if a string is collapsible: Difference between revisions

Content deleted Content added
Line 662: Line 662:


collapse :: String -> String
collapse :: String -> String
collapse s = catMaybes $ zipWith(\a b -> if a /= b then a else Nothing) (Nothing : ms) ( ms <> [Nothing])
collapse s = catMaybes $ zipWith(\a b -> if a /= b then a else Nothing) (Nothing : ms) (ms <> [Nothing])
where ms = map Just s
where ms = map Just s