Allow for some and/or in regexes
This commit is contained in:
@@ -18,6 +18,8 @@ module ListHelp
|
||||
, takeWhileArb
|
||||
, takeWhileArb'
|
||||
, foldrWhileArb
|
||||
|
||||
, wordsBy
|
||||
) where
|
||||
import Data.List
|
||||
import Data.Ord
|
||||
@@ -108,3 +110,10 @@ foldrWhileArb _ z _ _ _ [] = z
|
||||
foldrWhileArb h z t f y (x:xs) = case f y x of
|
||||
y' | t y' -> h x $ foldrWhileArb h z t f y' xs
|
||||
| otherwise -> h x z
|
||||
|
||||
wordsBy :: Eq a => a -> [a] -> [[a]]
|
||||
wordsBy x xs = case dropWhile (==x) xs of
|
||||
[] -> []
|
||||
xs' -> w : wordsBy x xs''
|
||||
where
|
||||
(w,xs'') = break (==x) xs'
|
||||
|
||||
Reference in New Issue
Block a user