Add removeItem utility function

This commit is contained in:
hasufell 2014-10-08 16:27:59 +02:00
parent b9048325c0
commit da3f71bfc0
No known key found for this signature in database
GPG Key ID: 220CD1C5BDEED020
1 changed files with 5 additions and 0 deletions

View File

@ -11,3 +11,8 @@ splitBy f s = case dropWhile f s of
[] -> []
s' -> w : splitBy 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) []