Mary Rose Cook's notebook

The public parts of my notebook.

My homepage.

Subtext: two-way data flow

Two-way Dataflow on Vimeo

This is a demo of the Subtext programming environment. You can modify values going into the program and the output is live-updated. You can also dig into the execution of the program to see the transformations of state at each step. Even cooler, you can modify the output of the program and all the computations get reversed to calculate the implied input. These transformations, too, are shown explicitly.

The visualisation of the transforms is cleverly done. Each operator or function seems to have its own visualisation. For example, a multiplication is exploded into the operator and the values of the arguments. More complex, a filter is exploded into its collection, its function and a view of the results of applying the fn to each element of the collection.

The flow of values from operation to operation is visualised as a downward flow of data. A value changed using the UI is visualised as a jump upwards that mutates the corresponding item of data. This change is then flowed back down through the operations.

There are some constraints to make this possible. The operations are all lazily evaluated functions. The possible jump mutations are a set of data structure modifications like “put last” on a list. These mutations can only act an data further up the program and can only see state further down the program.