Lambda¶
A Lambda is like a subflow but when executing it the nodes inside are not executed directly. Instead they are packaged into a data type that is sent to the output port on the outside of the Lambda to be executed at a later time.
Lambdas can be used to reduce duplication, to work with nested lists, and allow for conditional execution of nodes. They are created by right-clicking on an empty area of a workflow and choosing Create Lambda. To execute the contents of the Lambda use either Apply or Map.
A Lambda has only a single output on the outside. The type of the output is a function with argument types depending on the types connected to the input ports on the inside. Like with any other data type the output from Lambda can be used with any nodes that handle generic types, such as list or tuple operations.
If input data is needed to properly configure the Lambda, the input ports can be shown on the outside of the Lambda by right-clicking on the lambda and selecting Ports->Input->Create->Port[n]. These ports can then be used to connect data to be used for configuration. Note that this data is only used when configuring and will not be used when the Lamba is used with Apply or Map. To hide the port, right click on the port and choose Delete.
Some advanced use cases are also possible using Lambdas, for example putting Lambdas in lists to be executed using a Map.
See also the nodes Extract Lambdas and Extract Flows as Lambdas for a way to import Lambda functions from workflow files.