The problem of complexity is solved neatly in Prolog and Erlang¹, by counting “reductions”.
For simple tasks like in the article,
one function call ≅ one reduction.
Loops? There are no loops in Erlang, they are usually tail-recursive function calls.
¹) in Erlang it plays a very important role because the VM uses that information for scheduling.