I'm implementing lab 4 in Java, and all the good programs work when I
use call by value or call by name except good7.fun. Both my
implementations get a stack overflow there. However if I reduce the
parameter to odd in main, both of them work. Is this a reason to be
rejected? I have optimized away any unnecessary function calls and
stack allocations, and I'm starting to run out of options. One
possibility is to eliminate the recursion in java by using iteration
and a manual stack...
Cheers!
/Adam
http://en.wikipedia.org/wiki/Tail_call
There is a solution but it is more like a hack. The .NET virtual
machine for example has proper instruction for doing tail calls and
this in not a problem. It also not a problem with Haskell or any other
functional language.
If everything else works in your interpreter then send it as it is.
Krasimir