gnd

The let operation explicitly binds its input value to a named identifier within a Gendo pipeline. It acts purely as an identity transform, directly passing its input to its output without modifying it. The primary purpose of let is to provide clear and explicit naming for intermediate pipeline values, enhancing readability and clarity.

The syntax of the let operation is as follows:

[ $destination ] let [ argument ]

The $destination is optional. If omitted, the value is bound implicitly to the special slot _. The argument is also optional. When provided, it specifies the value or existing identifier to be bound to the destination. If the argument is omitted, the current value of _ is used implicitly. If both $destination and argument are omitted, _ is explicitly reset to an empty array, clearing any previously bound values.

An example of explicit binding using both destination and argument would look like this:

$persona let “You are a helpful assistant.”

In this example, the string “You are a helpful assistant.” is explicitly bound to the identifier persona.

Using let with only the destination (no explicit argument provided) binds the current value of _ to the new identifier. For example:

$context-param let

In this case, the current value of _ is assigned to context-param, and _ itself remains unchanged.

Using let without any arguments explicitly resets _ to an empty array. Although this usage is uncommon, it provides a clear mechanism to explicitly clear pipeline context:

let

After this instruction, the special slot _ holds an empty array, effectively clearing prior context or intermediate data.

All identifiers bound with let follow the single-assignment rule, meaning each identifier may only be assigned once within a pipeline. Attempting to rebind an identifier will result in an error.

The let operation itself is pure, meaning it does not perform any side effects and never modifies the values it passes through. It simply assigns names and manages the pipeline context explicitly.