Well, in my own case, I find recursive code to be somewhat more readable... something to go through and list all of the files in a directory and all of its sub directories is pretty trivial with recursion, but gets much more messy if implemented with ordinary iteration. But that's just my own personal take... I am sure there are people out there that find the iterative approach more readable. Also, with regard to memory management, in the recursive case you throw the burden of efficiency onto NI while in the iterative case you assume much more of that burden yourself.

In either case if is very infrequent that I use recursion in LabVIEW... so I don't lose too much sleep over it either way.

Salut!

At 10:13 AM 6/4/2004, you wrote:
Couldn't you just allocate a big enough stack to begin with, or allocate chunks of it as you go on(initialize and resize array) and get an efficient behavior?

It seems to me that recursion is needed when you you didn't think you would have needed it in the first place!!!(design phase)

-----Message d'origine-----
De : Jean-Pierre Drolet [mailto:[EMAIL PROTECTED]
Envoyé : June 4, 2004 9:51 AM
À : Dominic Lavoie; Info-LabVIEW
Objet : Re: Recursive Code Challenge


Salut,

You are right. Formally, recursion can always be emulated with a data stack and a while loop.
Using a recursive call, the data stack is managed automatically as data space is created for each recursion level. The cost in
LabVIEW is efficiency.


A recursive call makes the code more simple to design. The recursive nature of the code is explicit which is not the case with a
while loop.


Other than that, there are no clear advantage for the recusive call.

Jean-Pierre Drolet
www.avensys.ca



----- Original Message -----
From: "Dominic Lavoie" <[EMAIL PROTECTED]>
To: "Info-LabVIEW" <[EMAIL PROTECTED]>
Sent: Friday, June 04, 2004 9:15 AM
Subject: RE: Recursive Code Challenge


Salut.

Could someone explain in a simple way what are the advantages of making a function recursive instead of just making the data
recursive(arrays or strings) and building one function to play with that data(while loops)?





Confidentiality Warning: This message and any attachments are intended only for the use of the intended recipient(s), are confidential, and may contain privileged information. If you are not the intended recipient, you are hereby notified that any review, retransmission, conversion to hard copy, copying, circulation or other use of this message and any attachments is strictly prohibited. If you are not the intended recipient, please notify the sender immediately by return e-mail, and delete this message and any attachments from your system. Thank you.


Information confidentielle: Le présent message, ainsi que tout fichier qui pourrait y être joint, sont envoyés à l'intention exclusive de son ou de ses destinataires; ils sont de nature confidentielle et peuvent constituer une information privilégiée. Nous avertissons toute personne autre que le destinataire prévu que tout examen, réacheminement, impression, copie, distribution ou autre utilisation de ce message et de tout fichier qui y est joint est strictement interdit. Si vous n'êtes pas le destinataire prévu, veuillez en aviser immédiatement l'expéditeur par retour de courriel et supprimer ce message et tout document joint de votre système. Merci.

George Gatling Applied Technology Division, SFA Inc. Space Physics Simulation Chamber US Naval Research Laboratory 202-404-5405 (phone) 202-767-3553 (fax)

If trees could scream, would we be so cavalier about cutting them down?
We might, if they screamed all the time, for no good reason. --Jack Handy






Reply via email to