Beginner’s question: Say, from a list of numbers I want to remove all 17s – and I don’t want to use the
elem function, only
filter and operators.
My first approach was:
filter (\x -> x /= 17) lst
That works, but can be condensed to:
filter ((/=) 17) lst
When I see Haskell code (say on GitHub) it rarely has multiple parentheses – thus I assume the way I wrote this filter expression is not very “haskellonic” (like “pythonic”).
So here comes my question: Is there a way to write this expression with no or only one pair of parentheses?
PS: I tried the
filter $ (/=) 17 lst
but this doesn’t work. (I guess the compiler can’t resolve this syntactically).