I am new to Haskell. In the example below, the function deletes all occurrences of a particular element from a list and returns a new list. In addition, I am trying to use a helper function to get that returned list and output the length of it.
The problem I am having is a parse error during compile time, pointing to the line that contains delete _ [] = []
.
I appreciate any assistance in finding out the cause of the error.
countDelete y (x:xs) = length outputList
where outputList = delete y (x:xs)
delete _ [] = []
delete y (x:xs) | x==y = delete y xs
| otherwise = x:delete y xs