compileFunction2

fun <T0, T1, R> compileFunction2(expression: String, parameter0: String, parameter1: String, constants: (String) -> Any? = { null }, functions: TypedFunctionExtensions = TypedFunctionExtensions.EMPTY): (T0, T1) -> R(source)

Compiles a string expression into a lambda function with two parameters.

This function takes an expression as a string, as well as two parameter names, and returns a lambda that evaluates the expression with the provided parameter values. Optionally, a map of constants and custom functions can be provided for use in the expression.

Return

A lambda function that takes two parameters of types T0 and T1 and returns a result of type R, based on the compiled expression.

Parameters

T0

The type of the first parameter.

T1

The type of the second parameter.

R

The return type of the resulting lambda function.

expression

The string expression to compile.

parameter0

The name of the first parameter in the expression.

parameter1

The name of the second parameter in the expression.

constants

A lambda function that provides constant values by variable name. Defaults to returning null for all names.

functions

The custom functions available in the context of the expression. Defaults to an empty set of functions.

Throws

if either parameter name exists within the constants map.