Created
June 9, 2017 22:25
-
-
Save kejadlen/6acab829f8915e0fa72b5a2704325869 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Data.List | |
pairs xs = zip xs (tail xs) | |
repeatingPairs xs = filter (\(x,y) -> x == y) $ pairs xs | |
hasRepeatingPairs :: String -> Bool | |
hasRepeatingPairs xs = any (\pair -> length (elemIndices pair rps) >= 2) rps | |
where rps = repeatingPairs xs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment