Title: Message
ahh i see
 
thats pretty cool, its like your making your own stack.
 
It was nice to meet you too Dave, Scott's talks on xml and DOM gave me some interesting ideas im now trying to implement (:
 
Thank you too John, im going to try out method scope and see how it works.
 
Right now i have something kind of working, kind of not that i slapped together last night but it uses instance scope and creates a new tcf for each call so thats not too pretty.
 
Im kind of curious now, what kind of stuff have you guys had to use recursion for?
----- Original Message -----
Sent: Monday, September 29, 2003 8:11 AM
Subject: RE: Witango-Talk: Witango 5 and recursion

Hi Alan,
 
I've written many recursive algorythms and it sounds like you're on the right track.
 
The first time you call the method put the results into a local scope array. On subsequent calls add rows to the array, either at the beginning of the array or at the end depending on how you want them ordered. A simple IF tag should do. IF numrows > 0 addRows ELSE assign the array.
 
You may also want to add a check to prevent an infinite loop.
<@assign local$level <@calc 'sum(1 @@local$level)'>>
then if local$level > 25 don't call the method again, and throw an error or build some exception handler to deal with it.
 
Dave Shelley
 
PS. It was nice to meet you at the conference.
-----Original Message-----
From: Alan Wolfe [mailto:[EMAIL PROTECTED]
Sent: Monday, September 29, 2003 3:48 AM
To: [EMAIL PROTECTED]
Subject: Witango-Talk: Witango 5 and recursion

Heya guys,
 
I was wondering if there was a way to do recursion in witango 5?
 
I have a DOM variable im reading from a file and trying to show as it's tree structure and using indenting to show it at its different levels.
 
I have nodes that are "folders" and nodes that are "notes", folders can be openned and closed and notes are just there (like folders and files in an OS) so i need to show all oppened folders and their contents etc.
 
what i was thinking so far was have a tcf function that took a DOM variable and made an array of it's children.  Then it loops through the children and if it hits an open folder, call the tcf function again with the DOM object of that folder so it will do the subfolder then when its done continue with the current folder.
 
my only problem here is that local variables will get overwritten when i call the tcf function again inside itself right?
 
Method scope would be overwritten too and instance seems like it might work except id have to make a tcf object for each call of the function which that would add alot of overhead right?
 
I am looking at only 4 or 5 nested levels at maximum if that helps at all.
 
Its late so not sure if i explained this very well but does anyone have any ideas?
 
Thanks!
Alan
________________________________________________________________________
TO UNSUBSCRIBE: Go to http://www.witango.com/maillist.taf
________________________________________________________________________
TO UNSUBSCRIBE: Go to http://www.witango.com/maillist.taf

Reply via email to