Reputation: 320
I have an list of tuples looking like this:
[("APPLE",["APPLE","BANANA","PEAR"]),("ANANAS",["ANANAS","BANANA","APPLE"])]
However I would like to remove any occurrence of the first element in the tuple from the snd list in the tuple. So I would like the list of tuples to look like:
[("APPLE",["BANANA","PEAR"]),("ANANAS",["BANANA","APPLE"])]
Upvotes: 2
Views: 57
Reputation: 320
I solved it using:
map (\(x, y) -> (x, filter (/=x) y)) list
Upvotes: 4