I have a list of natural numbers [1..n] (this list is never empty) and I would like to filter each element by testing a predicate with all other elements in the list. I would like to return a list of those numbers who never fulfilled the predicate. My idea is this:
filter (\x -> 1 == length [y| y <- [1..n], pred y x]) [1..n]
I am testing if the length is equal to 1 since for x==y the predicate returns true.
This does work as intended, however, I was wondering if there is a cleaner way to do this. I'm not really looking for more performance, but rather a more simple solution.