# LSLambdaFunction Delegate¶

Lambda function delegates. These particular delegates are used to instantiate LambdaFunction in LocalSolver.

A lambda function is a particular LSExpression composed of two parts:

• The arguments of the function (which are also LSExpression of type Argument).
• The body of the function. The body is an LSExpression that will be used to evaluate the result of the function. The body can be any LSExpression composed of any operands and operators supported by LocalSolver.

The following delegates are used by the method LSModel.CreateLambdaFunction to instanciate very easily, in one declaration, the arguments and the body of the LocalSolver function.

 since: 9.5
delegate LSExpression localsolver.LSLambdaFunction0()

Delegate used to create a lambda function without argument. This delegate can be used with the method LSModel.CreateLambdaFunction. In that case, your delegate will be called once, without argument. It must return an LSExpression that will be used as the body of your LocalSolver lambda function.

delegate LSExpression localsolver.LSLambdaFunction1(LSExpression a)

Delegate used to create a lambda function with one argument. This delegate can be used with the method LSModel.CreateLambdaFunction. In that case, your delegate will be called once, with one LSExpression of type Argument. It must return an LSExpression that will be used as the body of your LocalSolver lambda function.

delegate LSExpression localsolver.LSLambdaFunction2(LSExpression a, LSExpression b)

Delegate used to create a lambda function with two arguments. This delegate can be used with the method LSModel.CreateLambdaFunction. In that case, your delegate will be called once, with two LSExpression of type Argument. It must return an LSExpression that will be used as the body of your LocalSolver lambda function.

delegate LSExpression localsolver.LSLambdaFunction3(LSExpression a, LSExpression b, LSExpression c)

Delegate used to create a lambda function with three arguments. This delegate can be used with the method LSModel.CreateLambdaFunction. In that case, your delegate will be called once, with three LSExpression of type Argument. It must return an LSExpression that will be used as the body of your LocalSolver lambda function.

delegate LSExpression localsolver.LSLambdaFunction(LSExpression[] arguments)

Delegate used to create a lambda function with arguments. This delegate can be used with the method LSModel.CreateLambdaFunction. In that case, your delegate will be called once, with an array of LSExpression of type Argument. The size of the array will depend on the number of arguments you want for your lambda function. The number of arguments is specified when you call the method LSModel.CreateLambdaFunction. This delegate must return an LSExpression that will be used as the body of your LocalSolver lambda function.