Reducing a Sequence of Events to State

A reducer computes a next state from a current state and one event. Replaying an ordered event sequence can reconstruct a result.

Source
Anbloq
Language
English
Created
Updated
Chapters
2
Reading time
1 min
In this article2 chapters
  1. Trace two edits
  2. Keep histories independent of time reads

Trace two edits

Starting with count zero, an add-two event gives two and a subtract-one event gives one. Adding a reset event changes which orderings agree. State transitions describe how each event is interpreted.

Keep histories independent of time reads

If applying one event consults today's time, replay later can differ. Put the relevant time into the event input or document the intended environment. Reproducing a run exposes such dependencies.[1]

References

  1. Python Software Foundation, Functional Programming HOWTO ↩