[Scilab-users] How to list the content of the recursion stack?
Jean-Yves Baudais
Jean-Yves.Baudais at insa-rennes.fr
Thu May 6 11:13:23 CEST 2021
Hi,
> [...] When we get a Recursion limit reached (1000) message [...]
I'm not a wizard on programming, not at all, and recursion call it's all the time complex for me to use. Anyway, I tested two different recursions and I'm really far from the "Recursion limit"! Here the examples:
function out=test_l(in)
if in==0 then
out=in;
return
end
out=in+test_l(in-1);
endfunction
//calling sequence
// test_l(n); // max n=41
function out=test_ll(in,acc)
if in<=1
out=acc;
return
end
out=test_ll(in-1,acc+in);
endfunction
//calling sequence
//test_ll(n,1); // max n=140
test_ll improves a bit test_l because it uses tail call, but the max without seg.fault is far from 1000. Where does this limit of 1000 come from?
-- Jean-Yves
More information about the users
mailing list