Super Stages

Return to Guide Main Page Return to Functions Page

Basic super stage stack

View Example Super Stage stack

Super Stages allow a sequence of stages to be used repeatedly on different sections of an input string. For instance, several steps of transformation may be repeated on each member of a list, or only on sequences of characters which match a regular expression.

While such operations may be possible with entirely linier stacks and the judicious use of regular expresions, the result is likely to be a long and difficult to understand.

New Super Stage with a defaut Echo function substage

When you select a super stage function from the function list String Thinger will automatically insert an Echo stage below it as the first sub stage. Substages can be distinguished by their left indent from the main stack. A set of substages is refered to as a "substack", and the super stage controling them is refered to a their "parent".

Adding substages

There are several ways to add stages to a substack. To add a new substage directly below the parent simply click on the '+' button of the super stage. To add a substage below an existing substage use the '+' button on that substage. It is also possible to move stages into a substack from above the parent or below the bottom of the substack by using the move down and move up buttons. For a stage above the super stage using the move down button will cause the stage to jump the super stage and become the top stage in the substack. For stages below the bottom of the substack using the move up button will cause the stage to become the last stage in the substack - in this case the stage does not change its relative position in the stack, it is simply indented to indicate its new status. Equally, using the move up button on the top sub stage or the move down button on the last will cause them to leave the substack and return to the normal stack flow.

Using the move up and move down buttons of a super stage will move both the super stage and its substack. To move a single stage past a substack and its parent rather than into the substack, simply shift-click the move button.

Moving over a super stage

It is also possible to have nested super stages. A super stage function can be selected for a substage which will create a new substack shown with an even deeper indent. Alternatively, a super stage and its substack can be moved into another substack using the move buttons. As with single stages, a super stage and it's substack can be jumped over another super stage and its substack by shift-clicking the move buttons.

Deleting a super stage only deletes the parent stage causing the sub stack to move back into the normal flow of the stack.

The Stages argument in the super stage header can be used to shift a whole set of stages below a super stage into and out of its substack at once by changing the value to the required length.

The Return argument found an most super stages provides a means to format the return from the processing of each value. This uses the same syntax as Replace argument in regular expression functions. The string $1 will become the original value prior to processing while $2 will become the returned value. For example, $1 ($2) will return the original value followed by the processed value in parentheses.