October 2014
Intermediate to advanced
280 pages
7h 20m
English
You’re going to start creating a server that implements a stack. The call that initializes your stack will pass in a list of the initial stack contents.
For now, implement only the pop interface. It’s acceptable for your server to crash if someone tries to pop from an empty stack.
For example, if initialized with [5,"cat",9], successive calls to pop will return 5, "cat", and 9.
The call function calls a server and waits for a reply. But sometimes you won’t want to wait because there is no reply coming back. In those circumstances, use the GenServer cast function. (Think of it as casting your request into the sea of servers.)
Just like call is passed to handle_call in the server, cast is sent to ...
Read now
Unlock full access