Hello, I've been trying to make a haskell function that gives two lists a few times and returns a new list
Where this new list is the union of the other two lists but without repetitions, ie a [1,2,3] [3,2,1] list should return [ 1,2,3] or a list [10,20,30] [90,80,30] should return [10,20,30,90,80] (see that 30 is in both lists, so it should not be in the list)
What I have is this:
uniaoS :: [Int] -> [Int] -> [Int]
uniaoS [] [] =[]
uniaoS [] (x:xs) =(x:xs)
uniaoS (x:xs) [] =(x:xs)
uniaoS(a:as)(x:xs)
| (a == x) = uniaoS as xs
| otherwise = a:as ++ x:xs
In this case it is returning the list minus the reps, ie [1,2,3] [1,2,4] returns [3,4] , but I would like it to also return the repeated elements [ 1,2 , 3,4]