I need to make a code that removes the first occurrence of an given element in a list. So far I have only managed to make the code remove every occurrence of the given element.
Her is my code rigth now:
rem2 :: Eq a => [a] -> a -> [a]
rem2 xs y = [x | x <- xs, x /= y]
If i try:
rem2 "hello" 'l'
The code will returne "heo", while I want it to returne "helo". Can someone help me?