Tail/Non tail recursion

Vlad Dumitrescu vlad_dumitrescu@REDACTED
Thu Aug 28 15:39:34 CEST 2003


----- 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,
> etc.

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 mailing list