deleteFirstsBy

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]
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.
Generic version of deleteFirsts
Returns a subsequence of the first stream, deleting first occurrences of those elements that are present in the second stream. Note that this is not a commutative operation. This is similar to the deleteFirstsBy.
>>> f xs ys = Stream.fold Fold.toList $ Stream.deleteFirstsBy (==) (Stream.fromList xs) (Stream.fromList ys)

>>> f [1,2,2,3,3,5] [1,2,2,3,4]
[3,5]
The following holds:
deleteFirstsBy (==) (Stream.ordNub s2 `append` s1) s2 === s1
deleteFirstsBy (==) (Stream.ordNub s2 `interleave` s1) s2 === s1
First stream can be infinite, second stream must be finite. Space: O(m) where m is the number of elements in the first stream. Time: O(m x n) where m is the number of elements in the first stream and n is the number of elements in the second stream. Pre-release
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 (\\). The second list must be finite, but the first may be infinite.
Overloaded version of (\\).
O(n*m). Takes a predicate and two slists and returns the first slist with the first occurrence of each element of the second slist removed.
>>> deleteFirstsBy (==) (slist [1..5]) (slist [2,8,4,10,1])
Slist {sList = [3,5], sSize = Size 2}
A more efficient deleteFirstsBy for streams sorted in ascending order. Both streams can be infinite. Space: O(1) Unimplemented
Symbolic version of deleteFirstsBy, the result would be merged and propagate the mergeable knowledge. Can generate O(len(lhs)) cases, and O(len(lhs)^2 * len(rhs)) sized constraints, assuming the predicate only generates O(1) constraints.