All you really need is an open-ended while loop.  No recursion is necessary, not even 
internal recursion with gosubs.  For a "tree" type example:
 
list = root.item
list.cntr = 1
while (list<1,list.cntr> # '') do
  children = list.children
  child.ins.cntr = list.cntr
  for child.cntr = 1 to num.children
    child = children<1,child.cntr>
    if (child not already in list) then ;* in case tree is really a graph with circuits
      child.ins.cntr = child.ins.cntr + 1
      list = ins(list,1,child.ins.cntr,child)
    end
  next child.cntr
  list.cntr = list.cntr + 1
repeat

________________________________

From: [EMAIL PROTECTED] on behalf of Kevin King
Sent: Mon 3/1/2004 9:49 AM
To: U2 Users Discussion List
Subject: RE: [UV] Recursive GOSUB



> The only problem is that internal subroutines do not have local
> variables so
> the second call is using the same variables as its parent.  If this is a
> problem, using dynamic arrays to stack the necessary items is quite neat.
>

At the risk of sounding like an ad, there's an article at
http://www.precisonline.com/inner.html discussing the concept of "inner
recursion", that is, recursing inside of a single program.

--Kevin
[EMAIL PROTECTED]
http://www.PrecisOnline.com



--
u2-users mailing list
[EMAIL PROTECTED]
http://www.oliver.com/mailman/listinfo/u2-users



Our company accepts no liability for the content of this email, or for the
consequences of any actions taken on the basis of the information
provided, unless that information is subsequently confirmed in writing.
Any views or opinions presented in this email are solely those of the 
author and do not necessarily represent those of the company.
WARNING: Computer viruses can be transmitted via email.
The recipient should check this email and any attachments for the 
presence of viruses. The company accepts no liability for any damage 
caused by any virus transmitted by this email.
11/29/2003 ACE Software, LLC

-- 
u2-users mailing list
[EMAIL PROTECTED]
http://www.oliver.com/mailman/listinfo/u2-users

Reply via email to