Comment Re:real world (Score 2) 186
Ah, gotcha. A slashdot post is not really sufficient to introduce the topic. Typically you use immutable data structures, which are often built over a mechanism called a "path copy". Basically, your app state is stored in a data structure, and when state is updated, you create a new data structure representing the new state, using purely functional code. People often think this is slow, but it's very fast, often faster than mutable code, except in very hot loops. The bit where you update the reference to the current state (change the reference from the old state to the new state) is a side effect, and is handled in different languages/frameworks in different ways. In some languages your code returns data that represents the state change (e.g. state monad) and the runtime handles the side effects, so you have no direct handle on the side effects. In other languages, there are stateful abstractions, like an "atom", that effectively separate the concept of a "value" from the concept of an "identity" (like the current state).
More generally, you separate side effects (including state) from the purely functional parts of the code. E.g. instead of writing a routine that prunes log files by date, you write a routine that reads dates (this is a side effect), one that reads the current time (also a side effect), and one that deletes files (also a side effect). Then you write a purely functional routine that takes a list of dates and returns a list of files to delete.
The overall goal is to get all your business logic into purely functional routines like this, because it hugely simplifies development, and reasoning about code. E.g. it's very easy write tests, because you don't have to mock anything. The code with side effects becomes extremely simple, so testing those becomes easier, too.
It's a huge topic, and I highly recommend looking for more info on youtube, and elsewhere.