Tail/Non tail recursion
Thu Aug 28 18:03:19 CEST 2003
Yes, this is what I meant even if I failed to write that into plain
language. I have a faint memory from several years ago, that there
was a compiler optimization for exactly this type of non-recursive
calls, that in fact made it behave like a tail-recursive function.
Maybe someone that KNOWS can tell us if anything like this exist.
> ----- Original Message -----
> From: "Luke Gorrie" <luke@REDACTED>
>> > square([H|T]) -> [H*H|square(T)];
>> > square() -> .
>> Short answer: That's best in that it uses time and space proportional
>> to the length of the list, just like lists:map, list comprehension,
> Did I miss the fact that the Erlang compiler now also does
> cons-tail-call optimizations? (or whatever it is called :-)
> I remember that was not the case for some versions ago, and I did not
> look at all the change logs... or I just forgot about it...
More information about the erlang-questions