I have a list and a If-statement:
a = {-3, 0, 5};
If[a[[1]] > 1 || a[[2]] > 1 || a[[3]] > 1 , 1, 0]
Output: 1
Is there a way to write the condition shorter? If the list is longer, the condition will get very long.
Or probably more general: Is there a way to create a function which would take the elements of a list and connect them with an operation?
If[AnyTrue[a, # > 1 &], 1, 0]
orIf[Or @@ Thread[a > 1], 1, 0]
is your after? $\endgroup$Count[a, _?(# > 1 &)] // Unitize
$\endgroup$