delete package:base

delete x removes the first occurrence of x from its list argument. It is a special case of deleteBy, which allows the programmer to supply their own equality test.

Examples

>>> delete 'a' "banana"
"bnana"
>>> delete "not" ["haskell", "is", "not", "awesome"]
["haskell","is","awesome"]
The deleteBy function behaves like delete, but takes a user-supplied equality predicate.

Examples

>>> deleteBy (<=) 4 [1..10]
[1,2,3,5,6,7,8,9,10]
>>> deleteBy (/=) 5 [5, 5, 4, 3, 5, 2]
[5,5,3,5,2]
The deleteFirstsBy function takes a predicate and two lists and returns the first list with the first occurrence of each element of the second list removed. This is the non-overloaded version of (\\).
(\\) == deleteFirstsBy (==)
The second list must be finite, but the first may be infinite.

Examples

>>> deleteFirstsBy (>) [1..10] [3, 4, 5]
[4,5,6,7,8,9,10]
>>> deleteFirstsBy (/=) [1..10] [1, 3, 5]
[4,5,6,7,8,9,10]