I am trying to build a function that takes the first element of a string, and removes all other elements equal to it from the string. Then does the same for the second character.
Ie - "Heello" would become "Helo" and "Chocolate" "Chlate"
My original attempt
removeSuccessor :: String -> String
removeSuccessor x = [c | c <- x, x ! `elem` c]
But that doesn't seem to work.. suggestions?
Data.List.nub?x ! `elem` c, I think you probably meannot (elem c x). Haskell doesn't use!for logical negation, andelemtakes its arguments in the other order (its type isa -> [a] -> Bool, not[a] -> a -> Bool.not (elem c x)is the same thing asc `notElem` xelemc x)] Still not working :\