我有这段代码,但它并没有完全满足我的要求,我需要一个元组列表;
[(3,2),(1,2),(1,3),(1,2),(4,3),(3,2),(1,2)]
并给出
[(1,3),(4,3),(3,2),(1,2)]
但我希望它给
[(1,3),(4,3)]
我在哪里做错了?提前致谢。
eliminate :: [(Int,Int)] -> [(Int,Int)]
eliminate [] = []
eliminate (x:xs)
| isTheSame xs x = eliminate xs
| otherwise = x : eliminate xs
isTheSame :: [(Int,Int)] -> (Int,Int) -> Bool
isTheSame [] _ = False
isTheSame (x:xs) a
| (fst x) == (fst a) && (snd x) == (snd a) = True
| otherwise = isTheSame xs a