I've implemented the following
nub' or "give distinct elements of list" function:
nub' :: (Eq a) => [a] -> [a] nub'  =  nub' xs = nubHelper xs  nubHelper :: (Eq a) => [a] -> [a] -> [a] nubHelper  acc = acc nubHelper (y:ys) acc = if(contains y acc) then nubHelper ys acc else nubHelper ys (acc ++ [y]) where contains match acc = foldl (\as x -> if(y == x) then True else as) False acc
*Main> nub' [1,2,1,1,1,1,3,4,3,1] [1,2,3,4]
Surely there must be a cleaner way?