>This seems like it wouldn't be tail recursive. So does the erlang compiler<br>>optimize this somehow?<br><br>Google for "tail recursion modulo cons."  No, the current Erlang compiler doesn't handle it.  I brought this up back 2002:
<br><br><a href="http://erlang.org/ml-archive/erlang-questions/200211/msg00158.html">http://erlang.org/ml-archive/erlang-questions/200211/msg00158.html</a><br><br>(The short version is that it requires changes to the garbage collector in order to work.)
<br><br>James<br>