package org.matheclipse.core.reflection.system;
import org.matheclipse.core.eval.exception.WrongNumberOfArguments;
import org.matheclipse.core.eval.interfaces.AbstractFunctionEvaluator;
import org.matheclipse.core.expression.F;
import org.matheclipse.core.interfaces.IAST;
import org.matheclipse.core.interfaces.IExpr;
import org.matheclipse.core.interfaces.ISymbol;
/**
* Predicate function
*
* Returns True if the 1st argument evaluates to
* True; False otherwise
*/
public class TrueQ extends AbstractFunctionEvaluator {
public TrueQ() {
}
@Override
public IExpr evaluate(final IAST functionList) {
if (functionList.size() != 2) {
throw new WrongNumberOfArguments(functionList, 1, functionList.size() - 1);
}
return F.bool(functionList.arg1().equals(F.True));
}
@Override
public void setUp(final ISymbol symbol) {
symbol.setAttributes(ISymbol.LISTABLE);
}
}
Ads help maintain this website.