In Mathematica one can do something like the following:
lst = {1, 2, 3};
If[Length[lst] != 0, Print["list is not empty"],
Print["list is empty"]]
(*list is not empty*)
Is there something relevant to automatic Boolean casting?
E.g., for L being a list
If[L,Print["list is not empty"], Print["list is empty"]]
would return list is not empty. That is, using the non-Boolean type with an If statement will cast the first to a Boolean.
As a second example
(*for n being an integer*)
If[n%2,Print["n is odd"],Print["n is even"]
would return n is odd for, e.g. 19.
Boole, i.e., a built-in function that maps{0,1}to{False,True}. – Felix Feb 27 '17 at 21:00