Search in sources :

Example 1 with AbstractCoreFunctionEvaluator

use of org.matheclipse.core.eval.interfaces.AbstractCoreFunctionEvaluator in project symja_android_library by axkr.

the class F method localBiFunction.

public static IBuiltInSymbol localBiFunction(final String symbolName, BiFunction<IExpr, IExpr, IExpr> function) {
    IBuiltInSymbol localBuittIn = new BuiltInSymbol(symbolName, java.lang.Integer.MAX_VALUE);
    localBuittIn.setEvaluator(new AbstractCoreFunctionEvaluator() {

        @Override
        public IExpr evaluate(IAST ast, EvalEngine engine) {
            return function.apply(ast.arg1(), ast.arg2());
        }
    });
    return localBuittIn;
}
Also used : IBuiltInSymbol(org.matheclipse.core.interfaces.IBuiltInSymbol) AbstractCoreFunctionEvaluator(org.matheclipse.core.eval.interfaces.AbstractCoreFunctionEvaluator) EvalEngine(org.matheclipse.core.eval.EvalEngine) IAST(org.matheclipse.core.interfaces.IAST) IExpr(org.matheclipse.core.interfaces.IExpr) IBuiltInSymbol(org.matheclipse.core.interfaces.IBuiltInSymbol)

Aggregations

EvalEngine (org.matheclipse.core.eval.EvalEngine)1 AbstractCoreFunctionEvaluator (org.matheclipse.core.eval.interfaces.AbstractCoreFunctionEvaluator)1 IAST (org.matheclipse.core.interfaces.IAST)1 IBuiltInSymbol (org.matheclipse.core.interfaces.IBuiltInSymbol)1 IExpr (org.matheclipse.core.interfaces.IExpr)1