All the answers so far seem to have missed the requirement that the matched objects be atomic . The following does the following:
Cases[testList, {a___?AtomQ} /; Equal[a]]
If you do not define identity in the sense of Equal , you could use:
Cases[testList, {(a_?AtomQ) ...}]
With a slightly modified test list, you will see that other methods do not meet the requirements
testList = {{1, 1.0, 1.0}, {a, b, c}, {Exp[Pi] + 1, Exp[Pi] + 1, Exp[Pi] + 1}, {}, {3}};
they all incorrectly match the third element.
Sjoerd C. de Vries
source share