I need to develop my own filter function similar to how filter works in Haskell but by using list comprehension and a predicate. So I would put lcFilter (>3) [1,2,3,4,5,6,10,444,3] in ghci and it would print all numbers greater than 3.
My code is based on a recursion example which I'm good at but I can't seem to convert to list comprehension. It seams no matter what I put in [x | x<-xs, p] it always throws a compiler error. I know the p part is wrong. I've tried ==p, xs==p and just about everything else I could think of. This makes me think some other part might be wrong but I'm really not sure.
Here is the code for my function lcFilter. I'm not sure if some or all of it is wrong so I'm posting the whole thing.
lcFilter :: (a -> Bool) -> [a] -> [a]
lcFilter _ [] = []
lcFilter p (x:xs) = [x | x<-xs, p]
If I type lcFilter (>3) [1,2,3,4,5] it should print [4,5] just like the standard Haskell filter function.