How about this one?
defmodule Example do
@remove_limit 1
# function head for a default argument
def sample(list, removed_so_far \\ 0)
# check if we have reached a remove limit
def sample(_list, removed_so_far) when removed_so_far > @remove_limit, do: false
# if a limit is not reached so far and a list have last item left
def sample([_head], _removed_so_far), do: true
# if a limit is not reached so far and a list is empty
def sample([], _removed_so_far), do: true
# if first and second item are not a part of an increasing list
# then function calls itself without a second argument
# if that would fail (return false) then function calls again itself
# but this time without a first argument instead
def sample([first, second | tail], removed_so_far) when first >= second do
removed_so_far = removed_so_far + 1
sample([first | tail], removed_so_far) || sample([second | tail], removed_so_far)
end
# in any other case we just skip a first item and perform check for a list's tail
def sample([_first, second | tail], removed_so_far) do
sample([second | tail], removed_so_far)
end
end






















