Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Insuffient Stack Space
Message
 
 
To
23/03/1998 04:32:35
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
00084835
Message ID:
00086434
Views:
32
Justok,

If I remember my compiler theory class, every recursive algorithm can be expressed in non-recursive code. But where an algorithm can be expressed recursively the code is typically more "elegant". Here's one from my toolbox of debugging code:

* FullName.prg  13-Jun-95

* Generate an object's full containership name

* 03-Dec-95 added additional validity testing
* 26-Apr-96 added testing to handle _VFP object which is its own .Parent
* 15-Jan-98 used IsObject()

function FullName( roObject )

if ( IsObject( m.roObject ) )
   if ( ( type( "roObject.Parent" ) == 'O' ) and ;
        ( roObject.Name != "Microsoft Visual FoxPro" ) )
      return ( FullName( roObject.Parent ) + "." + roObject.Name )
   else
      return roObject.Name
   endif
else
   return ""
endif


And if it wasn't for the error checking code the above stuff would show it's simplicity.

>Oh.... I nearly forgot Recursion because I can use simple SQL command or
>control loop instead of it. But I really want to know, is there any cases
>need to program it in recursion?!
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform