Filter list items by length in Haskell
haskell
Solution
Natalie's answer is perfectly correct, but as an alternate form you could also write it as
filter ((> 2) . length) ["a", "ab", "abc", "abcd"]
Or with list comprehension as
[str | str <- ["a", "ab", "abc", "abcd"], length str > 2]
All three are equivalent
Problem
I have a list like `["a","ab","abc", "abcd"]` How to get a list that only has the items which have a length > 2. Means the result is `["abc","abcd"].`