There are plenty of legitimate situations where complex
recursion can be used that will output "complex"
stack dumps and is not a demonstration of being
overkill.
Also a lot of folks generalize that recursion only exists
if the calling the procedure calls itself. I think
some of the most interesting examples of recursion are
when procedure a, calls b, calls c, which then calls a.
Heuristics would again get tricky. A good example of
this is parsing expressions.
Going slightly off topic:
Also keep in mind that you can have deep recursion
in UCBLogo/MSWLogo that is detecteed as tail recursive
which is just as therectically efficient as iterative
solutions and is just an alternive interative syntax.
Think of the common example in C where folks do
something like.
for (pointer=&things;pionter!=null;pointer=pointer.next)
{
do stuff with pointer
}
And in logo
to do_stuff :things
if emptyp :things [stop] ; pointer != null
do something with first :things ; do stuff
do_stuff butfirst :things ; pointer=pointer.next
end
Chuck Shavit wrote:
>
> At 12:44 AM 4/26/98 -0400, George Mills wrote:
> >I think your idea of a call stack of errors is great.
> >But could get a bit messy on deeply recursive procedures.
>
> Should be easy enough to add heuristics which will print something like
> ADD cannot add a non numeric value. It had inputs A and 3.
> It was called from ADDLISTS [A 6] [9 2]
> Which was called from ADDLISTS [4 A 6] [1 9 2]
> ... (75 nested calls to ADDLISTS)
> Which was called from ADDLISTS [(78 members...)] [(78 members...)]
> Which was called from MAIN
> Which was called from the command line.
>
> Plus (sorry Brian, I had to add this), messy traceback on deeply recursive
> calls could demonstare the suitability of for-loop style iteration to some
> cases where recursion is an overkill.
>
> Chuck Shavit
> ---------------------------------------------------------------
> Please post messages to the Logo forum to logo-l@gsn.org. Mail
> questions about the list administration to logofdn@gsn.org. To
> unsubscribe send unsubscribe logo-l to majordomo@gsn.org.
--
===============================================================
George Mills (mills@softronix.com)
http://www.softronix.com/
The www page contains some very powerful educational software.
Our single most important investment is our kids.
---------------------------------------------------------------
Please post messages to the Logo forum to logo-l@gsn.org. Mail
questions about the list administration to logofdn@gsn.org. To
unsubscribe send unsubscribe logo-l to majordomo@gsn.org.
Global SchoolNet Foundation -
Linking Kids Around the World!
Copyright GSN - All Rights Reserved
- Comments
& Questions
Visit GSN's
Global
Schoolhouse for more exciting learning resources!
Search our Site
-
Home