%mathpiper,def="IsBoolean"

Function ("IsBoolean", {x})
	(x=True) Or (x=False) Or IsFunction(x) And Contains({"=", ">", "<", ">=", "<=", "!=", "And", "Not", "Or"}, Type(x));

%/mathpiper



%mathpiper_docs,name="IsBoolean",categories="User Functions;Predicates"
*CMD IsBoolean --- test for a Boolean value
*STD
*CALL
	IsBoolean(expression)

*PARMS

{expression} -- an expression

*DESC

IsBoolean returns True if the argument is of a boolean type.
This means it has to be either True, False, or an expression involving
functions that return a boolean result, e.g.
{=}, {>}, {<}, {>=}, {<=}, {!=}, {And}, {Not}, {Or}.

*E.G.

In> IsBoolean(a)
Result: False;
In> IsBoolean(True)
Result: True;
In> IsBoolean(a And b)
Result: True;

*SEE True, False
%/mathpiper_docs