3.5. Lambda

3.5.1. Creation

Lambda(Argument, Body)
Parameters:
  • Argument – unevaluated parameter name
  • Body – unevaluated body of the lambda

Create an anonymouse function taking one argument. When the lambda is found in the formula, variables not present in it’s argument list are bound to variable in the environment before any call of the lambda function.

The Lambda function in EQ is just a limited version of the full function declaration, but can instantiated in any formula, depending of other parameters.

$ eq eval 'x := 3; (Lambda( x, x * x ))( 4 )'
16

The argument and the body are not evaluated when executed.

3.5.2. Substitution in lambda

You can control if a substitution will happen by using one of the evaluation controlling function :

$ eq eval 'x := 3; (Lambda( x, Force(x) * x ))( 4 )'
12

You can see Evaluation control for further information

Table Of Contents

Previous topic

3.4. Variables

Next topic

3.6. Evaluation control

This Page