October 2014
Intermediate to advanced
280 pages
7h 20m
English
Give your stack server process a name, and make sure it is accessible by that name in iex.
Add the API to your stack module (the functions that wrap the GenServer calls).
Implement the terminate callback in your stack handler. Use IO.puts to report the arguments it receives.
Try various ways of terminating your server. For example, popping an empty stack will raise an exception. You might add code that calls System.halt(n) if the push handler receives a number less than 10. (This will let you generate different return codes.) Use your imagination to try different scenarios.
An OTP GenServer is just a regular Elixir process in which the message handling has been abstracted ...
Read now
Unlock full access