HP Forums
"Running non recursive evaluator" - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: "Running non recursive evaluator" (/thread-1617.html)



"Running non recursive evaluator" - Peter Van Roy - 06-14-2014 06:03 PM

This occurs whenever recursion depth goes beyond the "Recursive Function" parameter in the CAS Setting. The maximum limit for this parameter seems to be 100. That is not very deep for recursive algorithms, especially since the Prime does not seem to do tail recursion optimization. Here is a simple example:
Code:
(x,a)->BEGIN
  IF x=0 THEN RETURN(a); ELSE RETURN(f(x-1,x*a)); END;
END
Calling f(99,1) works but if I call this as f(100,1) then I get the warning message "Running non recursive evaluator", which requires a click to exit (and seems to be much slower). Is there a way to do deeper recursion? Ideally, the limit should be much higher or even unbounded (with run-time error for stack overflow), but I would be content to have tail recursion!

PS, the typo "Rescursive Evaluation" in CAS Settings is still there in the new firmware.


RE: "Running non recursive evaluator" - parisse - 06-14-2014 06:43 PM

I don't know any portable way to check for stack overflow in C. That's the reason for the max recursive eval parameter. Initially, you got a runtime error if the max number of recursive calls was reached, later I implemented a non-recursive evaluator (with dynamic allocation of the space required to make recursive calls), you don't get an error anymore, but it's slower, therefore the warning remains.
By the way, you should not consider the CAS programming language like a traditional programming language designed by CS people for large projects. Like for many other CAS, it's just a scripting language to make easily small programming extensions (say up to about 1000 lines of code on a PC). Large CAS development should be done in C++ on a PC/Mac with libgiac.


RE: "Running non recursive evaluator" - Alberto Candel - 11-07-2016 03:11 AM

After upgrading to the latest software version, running any of my cas programs shows "Running non recursive evaluator" After "enter'' I may get a result, but not always. I have not been able to figure out why this is happening. Does anyone know? Thanks.


RE: "Running non recursive evaluator" - cclinus - 11-07-2016 01:42 PM

Hi Alberto,

In CAS Setting mode Page 2.
Try to set Recursive Function to 100.
(Max is 100 already, So it may not help Peter's problem)
But it solve my problem.

[attachment=4119]