Operations

StateTracker provides composable operations for building complex state structures from simple leaf states. Each operation returns a new State, so calls can be chained into declarative pipelines. All examples assume:

from statetracker import Manager, State

Composition Operations

Combine multiple states into a single derived state.

Operation

Description

Product (Cartesian Product)

Cartesian product of states (values multiply)

Stack (Disjoint Union)

Disjoint union of states (values add)

Interleave

Round-robin alternation between states


Transformation Operations

Create a new state by transforming an existing state’s values.

Operation

Description

Slice

Select a subset of values using Python slice syntax

Repeat

Cycle through a state’s values multiple times

Shuffle

Random permutation of values

Sample

Random subset of values (with or without replacement)

Split

Divide a state into multiple sub-states


Synchronization Operations

Link states so they track each other’s values.

Operation

Description

Synchronize

Synchronize two states and create mirrored aliases