This is not a result of using higher order functions per se, but of tail call optimisation. If the very last thing a function does before returning is calling another function, then the Erlang VM optimises away the stack frame, since it is not needed anymore. (This is why you can do recursion without overflowing the stack.)
In your example, both f
and h
do tail calls, and their stack frames are therefore not visible in the stacktrace. On the other hand, a
, b
and c
do not do tail calls, since they have to perform an addition on the result of the function they are calling before returning to the caller.