Chapter 6State and Concurrency

A state is the value of an identity at a point in time.

Quite a lot is packed into the previous sentence. Let’s unpack the word value first. A value is an immutable, persistent data structure. When you can program entirely with values, life is easy, as we saw in Chapter 4, Functional Programming.

The flow of time makes things substantially more difficult. Are the New York Yankees the same now as they were last year? In 1927? The roster of the Yankees is an identity whose value changes over time.

Updating an identity does not destroy old values. In fact, updating an identity has no impact on existing values whatsoever. The Yankees could trade every player, or disband in a fit of boredom, without in any ...

Get Programming Clojure, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.