
28 Jun
2001
28 Jun
'01
4:44 a.m.
Jerzy Karczmarczuk wrote:
Alastair David Reid:
Note that "recursive" doesn't (necessarily) mean "stack hungry" in functional languages. Only imperative languages feel compelled to guarantee that infinitely recursive functions will run out of stack space.
Well, a STRICT functional language doesn't seem to have much choice either. Or am I missing some nice trick? (Don't mention tail recursion).
There are some other tricks to play to convert non-tail recursive functions into tail recursive ones. E.g., the map function (using the standard definition) has been optimized by LISP compilers since the stone age to avoid using stack. -- Lennart