Immutable Data
Get familiar with the benefits of immutability in functional programming languages.
We'll cover the following...
We'll cover the following...
If we listen to functional programming experts, we’ll hear them make a big deal about immutability, which is the fact that in a functional program, data cannot be altered once created. And, indeed, Elixir enforces immutable data. But why?
Let’s forget about Elixir for a moment and think about our current programming language of choice. Let’s imagine we wrote this:
count = 99
do_something_with(count)
print(count)
We’d expect it to output 99
. In fact, we’d be very surprised if it didn’t. We believe that count
will always have the value ...