Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to do Factorials in VFP with Recursion
Message
De
22/02/2000 15:09:30
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00335196
Message ID:
00335568
Vues:
15
Joe,

Right, and thanks for the reply. I actually have a Treeview Control that's populated by a recursive program, much more along the lines of correctly answering my own question. I'll be posting it here this week as soon as I get a minute.

Best,

DD

>>What 'types' of programs do you recommend using recursion? I've used them for multi-level types of organizations and relationships where they seem to do well. I'm curious as to other types of applications as well.
>>
>
>I use them when I'm writing a function and I get to a point where I say "Okay, now I have to call THIS function."
>
>I think the factorial idea is a good illustration of recursive functions for people to gain an understanding of recursive functions, but, as was pointed-out by Paul, it is not a practical way to use recursion. This is what happens when you ask the question "Where can I use recursion?" What should happen is "I have this requirement, now what is the best way to satisfy this requirement?" If the answer is recursion, then go for it. But I think it makes sense to wait for these things to present themselves rather than trying to dream up situation where recursion can be used.
>
>That said, offhand I can give one example of where I use recursion. A Number-To-Words conversion function. This works because of the way the English language deals with numbers (235 = "two hundred and thirty-five", 235000 = "two hundred and thirty-five thousand", etc.). You have the same basic function and just add a decriptive to the group of numbers (thousand, million, billion, etc.). BTW, I don't think we've ever written a billion dollar cheque. I also don't know if this would work for other languages too. I know a lot more computer languages than human languages.
>
>Joe
Best,


DD

A man is no fool who gives up that which he cannot keep for that which he cannot lose.
Everything I don't understand must be easy!
The difficulty of any task is measured by the capacity of the agent performing the work.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform