Skip to content

Array functions like map/reduce #436

Discussion options

You must be logged in to vote

Something like below should work

@FunctionParameters({
  @FunctionParameter(name = "array"),
  @FunctionParameter(name = "placeholder", isLazy = true),
  @FunctionParameter(name = "mapper", isLazy = true)
})
public class MapFunction extends AbstractFunction {
  @Override
  public EvaluationValue evaluate(
      Expression expression, Token functionToken, EvaluationValue... parameterValues)
      throws EvaluationException {
    List<EvaluationValue> array = parameterValues[0].getArrayValue();
    String placeHolder = parameterValues[1].getExpressionNode().getToken().getValue();
    ASTNode mapper = parameterValues[2].getExpressionNode();

    List<EvaluationValue> mapped = new ArrayList<>…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by uklimaschewski
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants