Clojure - Values and Change: Clojure’s approach to Identity and State (clojure.org)
from HaraldvonBlauzahn@feddit.org to programming@programming.dev on 22 Feb 08:18
https://feddit.org/post/26163736

This is an article that influenced me a lot and made me understand the core idea of functional programming style.

Perhaps it clicked with me because I am a physicist. Physics describes changing objects - rigid bodies, atom quantum systems, electrodynamics - by equations. But the equations are functions: a set of quantities and states goes in, and a new state comes out. The functions by themselves are timeless.

And yet you can describe a rocket with this.

Clojure and pure functional programming applies that to software.

And it works! You can simulate a rocket with it, as aphyr showed in his brilliant example.

Clojure has, by default, no changing variables. Every value is immutable, like a string or a tuple in Python. As modifying a string in Python creates a new string, modifying a dictionary, vector, set or list in Clojure creates a new collection object. This is not as efficient as Rust, but stunningly elegant and very well suited for things like concurrent web servers.

More information on clojure here:

clojure.org/about/rationale

(aphyr has also written an introduction to Clojure, “Clojure from the Ground up”', and there are several other really good ones on-line, like “Clojure for the Brave and true”.)

#programming

threaded - newest