David Bremner on Fri, 8 Dec 2000 18:02:06 -0400 (AST)


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

return and the heap


Over the last week or so I have been plaguing the list with my
troubles with heap usage in gp. I seem to have narrowed it down to the
fact that return makes a copy of the result of a recursive call (or 
something)

With the following script, the commented out version of the recursive 
call leaves only one thing on the heap, whereas the return leaves one
for every recursive call.  


foo(count)=
{

 if(count<=0, return(0));

\\ foo(count-1);
   return(foo(count-1));
}