Example #1
0
  @Override
  public SEXP apply(Context callingContext, Environment rho, FunctionCall call, PairList args) {

    Context functionContext = callingContext.beginFunction(call, this, args);
    Environment functionEnvironment = functionContext.getEnvironment();

    ClosureDispatcher.matchArgumentsInto(getFormals(), args, functionContext, functionEnvironment);

    if (Context.PRINT_IR) {
      System.out.println(function.getScope());
    }

    SEXP result = function.getScope().evaluate(functionContext);
    functionContext.exit();

    return result;
  }