For really complex things, you're better off defining a separate function. For small cases, you can use lambda or even something like
any predicate myList where predicate x = even x
any predicate myList where predicate x = even x
EDIT: even x is just a simplification. You could put something like where predicate x = (mod x 3) == 1
source share