Aggregate computing, step by step

Eight short chapters. Each one introduces an idea, shows it running on a simulated network, and ends with exercises.

The idea

Usually you program one device at a time: what it sends, to whom, how it reacts. With aggregate computing you describe what the whole network should compute: a field, one value per device, such as the distance from a point or the number of neighbours. Every device runs the same program, and the runtime takes care of the messages.

The theory behind it is the field calculus, now generalised as the eXchange Calculus (XC): the model of ScaFi, FCPP and Collektive. There are only a few operators; everything else is built by composing functions.

The simulator

Every chapter has simulated networks like this one. The editor holds the program: change it and the network restarts with the new code.

Chapters

  1. Rounds and state: how a program runs, and rep.
  2. Neighbours and fields: nbr, and reducing a field to a value.
  3. The gradient: share and a first distributed algorithm.
  4. Composing functions: reusable blocks and the standard library.
  5. Alignment and branches: what happens around an if.
  6. xc: a different message for each neighbour.
  7. Sensing and acting: inputs, outputs and the world around the program.
  8. On devices: the same code on Puck.js and ESP32.
  9. Real networks: lost messages, the Bluetooth format, rounded numbers.