To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.roboticsOpen lugnet.robotics in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / 5003
5002  |  5004
Subject: 
Re: recursion (was RE: Would-be hacker queries.)
Newsgroups: 
lugnet.robotics
Date: 
Wed, 12 May 1999 01:44:47 GMT
Original-From: 
JR Conlin <JRCONLIN@EMAIL.spamcakeCOM>
Viewed: 
917 times
  

Actually, he goes on to show that in some cases you can eliminate call
stack recursion using simple transforms as well.

Let me say that I have not looked at the algorythm in question, yet, so
forgive me if this is their solution...


For example, JVM does this by keeping a frame stack of methods that have
been executed. ...

The SmalltalkVM my last company built used much the same idea, however, one
might say that it was a truely recursive function. Each method was
reflected as a byte code. Each byte code contained a reference to the
"parent" code, we didn't have to worry about stack limitations because the
byte code objects themselves contained the reference information. Doing
something like this in traditional (Non-byte code based) languages would be
a tad prohibitive, but it was one of the joys of Smalltalk.

It also made detecting and trapping infinite loops really easy...


Any recursive algorithm can always be recoded as an iterative one.  The
iterative one is usually faster and always takes less space (the recursive
algorithm must always store the return address in addition to the data
needed for each step), but the recursive algorithm almost always looks
more elegant :).

True, true, but getting back to the point of the original post, you have to
teach the concepts of recursion to new programmers, just like you have to
teach other "dangerous" and "inefficient" coding procedures such as global
variables and gotos. The best way I have found to show someone both the
benefits and dangers of using such constructs is to make them debug someone
else's code ;).




Aloha,
JR
- - - - - - - - - -
JR Conlin                  jrconlin@email.com
Techno-Athiest yahooPage: jrconlin
                           <http://home.earthlink.net/~jrconlin>
--
Did you check the web site first?: http://www.crynwr.com/lego-robotics



Message is in Reply To:
  Re: recursion (was RE: Would-be hacker queries.)
 
Hi, Important clarification: "data stack" free recursion. This is an important significance. It's really only useful for systems with no data stack.... or alternately as an interesting conversation piece. What's usually more clever is using data (...) (26 years ago, 11-May-99, to lugnet.robotics)

21 Messages in This Thread:






Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    
Active threads in Robotics

 
Verified and Trusted Team of Hackers
16 hours ago
Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR