Functions are idempotent. It means that no matter how many times a function is called with the same arguments, it will always produce the same result.
Elixir for Java Developers, Episode I
Jusabe Guedes
1065

Elixir isn’t a pure functional language. Any function can interact with long-running processes, external systems, etc. which maintain state.

If I have comment_count/1 defined as a function that takes a Medium article ID and returns the number of comments, the result is going to be different after more people comment.

TBH, I couldn’t tell you exactly how a pure functional language like Haskell manages side effects, but I’m pretty sure it’s got something to do with its strong typing: A function that has side effects has a different type signature than one that doesn’t. I think this sort of forces you to push side effects to the edges of your system, so that the core of your code remains pure. My gut says that this is a good practice in Elixir too.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.