The Clojure Model
Clojure provides a different model. To explain it, let’s revisit the terms value, state, and identity and give them definitions that might be a bit different from the ones you’re used to.
In Clojure’s world, a value is an immutable piece of data, or a composite of immutable pieces of data. This differs from what we might consider a value in most object-oriented languages, where we’d consider both immutable data, such as integers and strings, and mutable data, such as most objects, to be values.
Next up is the notion of an identity. An identity is an entity that’s associated with a series of values over time. An identity is not a place, like a mutable memory cell, or the mutable objects we saw earlier. Neither is an identity ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access