module ListAux where -- Removing duplicate elements in lists: a variant of nub (from List). -- This is *not* the same as the built-in -- nub: this function chooses the last occurrence of an element, nub -- chooses the first, so -- -- Main> nubVar [1,2,2,1] -- [2,1] -- Main> nub [1,2,2,1] -- [1,2] nubVar :: Eq a => [a] -> [a] nubVar [] = [] nubVar (x:xs) | elem x xs = nubVar xs | otherwise = x : nubVar xs