Will my function below be tail-call optimized in Elixir?
def poller(func, args, interval) do
case apply(func, args) do
:done -> :done
:try_again ->
:timer.sleep(interval)
poller(func, args, interval)
end
end
From what I've read in beginner literature, the optimization applies only when the recursive call is the "very last thing" the function does.
How does this work inside other conditionals? e.g. What if my recursion call is the last thing inside an if, but there's an else block after?