Ergo.Stack.pop
You're seeing just the function
pop
, go back to Ergo.Stack module for more information.
Link to this function
pop(list)
You cannot pop an element from an empty stack.
At this point it's not clear if this operation should raise an exception or return an error. For now we'll return an error.
Examples
iex> alias Ergo.Stack
iex> s = Stack.new()
iex> assert {:error, nil, []} = Stack.pop(s)
iex> s = s |> Stack.push(true) |> Stack.push(false)
iex> assert [false, true] = s
iex> assert {:ok, false, [true]} = Stack.pop(s)