defmodule MyStack do use GenServer def start_link(args) do GenServer.start_link(__MODULE__, nil, name: args[:name]) end def init(_) do {:ok, []} end def handle_info({:push, el}, state) do {:noreply, [el] ++ state} end def handle_call(:pop, _from, [head | tail]) do {:reply, head, tail} end end