- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
splitOn :: (a -> Bool) -> [a] -> [[a]]
splitOn _ [] = []
splitOn f xs = removeEmpty $ takeWhile (not . f) xs: splitOn f (dropWhile (f) $ dropWhile (not . f) xs) where
removeEmpty [] = []
removeEmpty (x:xs)
| null x = removeEmpty xs
| otherwise = x: removeEmpty xs
words' :: String -> [String]
words' = splitOn (flip elem " \n\r\f\t\v\160")
Follow us!