Question

all I need is the following

deletesub:: [Int]->[Int]->[Int]

For example,

deletesub [2,1,4] [3,1,32,5,2,43,7,4] = [3,32,5,43,7]

I searched using the signature at hoogle but nothing :/

Was it helpful?

Solution 2

When I search hoogle for [Int] -> [Int] -> [Int], I get as the 5th result (\\), which is the list difference operator. If I search for Eq a => [a] -> [a] -> [a], it's the first result. Is that what you're looking for? Keep in mind that [1, 2, 3, 1] \\ [1, 2] == [3, 1], it only removes the first occurrence of each element of the second list from the first list.

OTHER TIPS

Try

deletesub lst = filter (`notElem` lst)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top