Class LambdaExpression

java.lang.Object
dev.frostlake.executor.expressions.LambdaExpression
All Implemented Interfaces:
Expression

public class LambdaExpression extends Object implements Expression
A lambda argument to a higher-order function — <param> -> <body> or (<param>, …) -> <body> (e.g. x -> x + 1, (acc, val) -> acc + val). Parameter names are kept alongside any DECLARED parameter type, which is significant: an element normally binds as a VARIANT, so arithmetic on it yields FLOAT, while a declared type casts it first. Live-verified on a real account: TRANSFORM([1,2], a -> a * 2) is [2.000000000000000e+00,4.000000000000000e+00] but TRANSFORM([1,2], a INT -> a * 2) is [2,4]. It is not evaluated on its own — TRANSFORM/FILTER/REDUCE apply the body per array element with the parameters bound to the element (and accumulator).
  • Constructor Details

  • Method Details

    • getParameters

      public List<String> getParameters()
    • getParameterTypes

      public List<String> getParameterTypes()
      The declared type of each parameter, positionally — null where the parameter was written without one.
    • getBody

      public Expression getBody()
    • accept

      public <T> T accept(ExpressionVisitor<T> visitor)
      Description copied from interface: Expression
      Accept a visitor for the visitor pattern
      Specified by:
      accept in interface Expression
    • toString

      public String toString()
      Overrides:
      toString in class Object