Skip to content

Instantly share code, notes, and snippets.

@Nicd
Created March 12, 2014 08:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Nicd/9503114 to your computer and use it in GitHub Desktop.
Save Nicd/9503114 to your computer and use it in GitHub Desktop.
Elixir looks nice
@doc """
Pop the next mode from the stack and return new Status record with the
mode or nil if there were no modes to pop.
"""
def pop(status) do
[head | tail] = status.mode_stack
status = status.mode_stack tail
case head do
[] -> nil
_ -> status.current_mode head
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment