Ignore items from a list of tuples

1

I have a list of String

[A,B]

And I have this tuple

[("A","B"),("A","C"),("B","A"),("B","C"),("C","A"),("C","B"),("C","D"),("D","C")]

I want to delete the items in the list from the list [A,B] ie get the next result

  

[("C","D"),("D","C")]

    
asked by Efrainrodc 28.06.2017 в 05:10
source

1 answer

1

If I understand correctly, you want to filter the list of tuples so that you do not have elements from another list. One solution would be to use list comprehension:

[(x,y) | (x,y) <- lista, x 'notElem' ["A","B"], y 'notElem' ["A","B"]]
    
answered by 28.06.2017 / 09:49
source