Creates a new LambdaExpression with the given variable name and expression body. The variable name is the identifier used in the expression body to refer to the input value of the lambda function.
The name of the variable used in the lambda expression.
The expression body of the lambda function.
ProtectedsyntaxProtectedvariableProtectedexpressionProtected OptionalcompiledGet the original syntax string that was used to create this expression. This can be useful for debugging, logging, or error messages to provide context about where the expression came from.
the original syntax string of the expression.
Get the name of the variable used in the lambda expression.
The name of the variable.
What expressions comprise the expression for use in caching/memoization.
an array of expressions that can be cached/memoized.
What data keys are required for this expression to be evaluated? This information is used by the rule engine to determine the dependencies between expressions and rules, and to ensure that all necessary data is available before evaluating the expression.
a set of data keys required for this expression to be evaluated.
What functions are invoked by this expression? This information can be used for optimization, caching, or to determine which function nodes in the graph are relevant for this expression.
a set of function names invoked by this expression.
Get the return type of the lambda expression. This can be an atomic type or an object type, depending on the expression body.
Optionalchecker: TypeCheckeroptional type checker to use for determining the return type. This is needed for cases where the return type depends on variable types or function return types.
The return type of the lambda expression.
Check the types of the expression using the provided type checker.
Optionalchecker: TypeCheckerthe type checker to use for validating the expression's types.
the result of the type check.
Evaluate the expression in the given context to compute its value. The implementation of this method will depend on the specific type of expression and how it computes its value based on the data in the context.
the current working context containing data and constants.
the computed value of the expression.
Get a string representation of the expression, which can be used for debugging, logging, or error messages.
a string representation of the expression.
Get a JSON representation of the expression, which can be used for serialization, logging, or visualization.
a JSON representation of the expression.
A LambdaExpression represents an anonymous function that takes a single variable as input and returns a value based on an expression. The variable name is used within the expression to refer to the input value of the lambda function. Lambda expressions are commonly used in array functions like map or filter to define the transformation or condition applied to each element of the array.
N.B. Lambda expressions are not standalone functions and cannot be called directly. They are meant to be used as arguments to higher-order functions that can execute them with the appropriate context. Use a ScopeContext and ScopeTypeChecker when calling lambda expressions.