Add a supervisor to your stack application. Use iex to make sure it starts the server correctly. Use the server normally, and then crash it (try popping from an empty stack). Did it restart? What were the stack contents after the restart?
Some servers are effectively stateless. If we had a server that calculated the factors of numbers or responded to network requests with the current time, we could simply restart it and let it run.
But our server is not stateless—it needs to remember the current number so it can generate an increasing sequence.
All of the approaches to this involve storing the state outside of the process. Let’s choose a simple option—we’ll write a separate ...