The Wolfram Language and Mathematica 10 (available now on the Raspberry Pi) have new functions — AnyTrue
, AllTrue
, NoneTrue
— which take a predicate and test any/all/none on the input list. For example:
AnyTrue[Range@5, EvenQ]
(* True *)
AllTrue[{True, False, False}, TrueQ] (* or Identity in place of TrueQ *)
(* False *)
These functions can also be turned into a predicate themselves by using just a test function as a single argument:
NoneTrue[StringQ]@{"a", 1, 23}
(* False *)