Add removeItem utility function
This commit is contained in:
parent
b9048325c0
commit
da3f71bfc0
5
Util.hs
5
Util.hs
@ -11,3 +11,8 @@ splitBy f s = case dropWhile f s of
|
|||||||
[] -> []
|
[] -> []
|
||||||
s' -> w : splitBy f s''
|
s' -> w : splitBy f s''
|
||||||
where (w, s'') = break f s'
|
where (w, s'') = break f s'
|
||||||
|
|
||||||
|
|
||||||
|
-- |Remove a given item from a list.
|
||||||
|
removeItem :: (Eq a) => a -> [a] -> [a]
|
||||||
|
removeItem x = foldr (\x' y -> if x' == x then y else x':y) []
|
||||||
|
Loading…
Reference in New Issue
Block a user