haskell removes all occurrences of a given value from within a list of lists

haskell

Solution

You need to map over the outer lists.

remove y xs = map (filter(\x -> x/= y)) xs

You don't actually need a lambda here, nicer:

remove y xs = map (filter(/=y)) xs

Problem

I would like to remove all occurrences of a given value from within a list of lists. For example, input: ``` 'a' ["abc", "bc", "aa"] ``` output: ``` ["bc", "bc", ""] ``` so far: ``` remove :: Eq a => a -> [[a ]] -> [[a ]] remove y xs = filter(\x -> x/= y) xs ``` I'm getting an error, thank you in advance.

Original source