An Introduction to Erlang
Subject:   Recursion? Goto?
Date:   2008-01-09 21:19:11
From:   MattKangas
Response to: Recursion? Goto?

Erlang supports efficient tail recursion. Since the chat server's functions recurse as the last statement in the function, they are tail-recursive, so they can recurse infinitely without penalty.

To quote the book ("Programming In Erlang", pp.149)

"A tail-recursive function can be compiled so that the last function call in a sequence of statements can be replaced by a single jump to the start of the function being called. This means that a tail-recursive function can loop forever without consuming stack space."

This is standard behavior for functional languages like Erlang, Scheme, Lisp, et al.