1. How can I STOP a cursed recursion?
- Posted by Dan Moyer <danielmoyer at prodigy.net> Jun 19, 2006
- 600 views
With some difficulty, I built a recursive procedure, which seems to work fine, except that I can't get it to STOP. It knows when it gets to where it should stop, & I put return in at that point, & when that didn't work, I set an external variable to 1 (=finished) when it got to that point, and added a test at the beginning of the procedure to "return" if it saw that var "finished", but that didn't work either. The procedure was to take a sequence of sequences like what "folder" would have when adding items to a TreeView, and go thru them to compute the correct positions to put those items into in a "horizontal" treeView. The procedure worked thru the items in a correct fashion, got to the last item just below the root item, knew it was where it should stop, but continues to maybe "unravel" previous left-over recursions, or something????? Is there some way to just STOP a procedure, even if it has been working recursivly?? Or maybe recursion is supposed to be limited to FUNCTIONS? procedure Help!() print(1,"help!") Help{} -- How can I stop!? end procedure Help! Dan
2. Re: How can I STOP a cursed recursion?
- Posted by ChrisBurch2 <crylex at freeuk.co.uk> Jun 19, 2006
- 557 views
Hi Is your stop variable local or global - it needs to be global
integer stop_me function foo() --do stuff --result to break out stop_me = 1 foo() if stop_me = 1 then end function
3. Re: How can I STOP a cursed recursion?
- Posted by ChrisBurch2 <crylex at freeuk.co.uk> Jun 19, 2006
- 566 views
I hit return too early, but you get the idea. Chris
4. Re: How can I STOP a cursed recursion?
- Posted by Igor Kachan <kinz at peterlink.ru> Jun 19, 2006
- 543 views
Dan Moyer wrote: > > > With some difficulty, I built a recursive procedure, which seems to work > fine, except that I can't get it to STOP. > > It knows when it gets to where it should stop, & I put return in at that > point, & when that didn't work, I set an external variable to 1 (=finished) > when it got to that point, and added a test at the beginning of the procedure > to "return" if it saw that var "finished", but that didn't work either. > > The procedure was to take a sequence of sequences like what "folder" would > have when adding items to a TreeView, and go thru them to compute the correct > positions to put those items into in a "horizontal" treeView. The procedure > worked thru the items in a correct fashion, got to the last item just below > the root item, knew it was where it should stop, but continues to maybe > "unravel" previous left-over recursions, or something????? > > Is there some way to just STOP a procedure, even if it has been working > recursivly?? Or maybe recursion is supposed to be limited to FUNCTIONS? > > > procedure Help!() > print(1,"help!") > Help{} > -- How can I stop!? > end procedure > > Help! > > Dan Hi Dan, Try please:
procedure Help() if get_key()!=-1 then return end if print(1,"help!") Help() -- How can I stop!? end procedure Help()
Regards, Igor Kachan kinz at peterlink.ru
5. Re: How can I STOP a cursed recursion?
- Posted by Dan Moyer <danielmoyer at prodigy.net> Jun 19, 2006
- 535 views
Igor Kachan wrote: > > Dan Moyer wrote: > > > > > > With some difficulty, I built a recursive procedure, which seems to work > > fine, except that I can't get it to STOP. > > > > It knows when it gets to where it should stop, & I put return in at that > > point, & when that didn't work, I set an external variable to 1 (=finished) > > when it got to that point, and added a test at the beginning of the > > procedure > > to "return" if it saw that var "finished", but that didn't work either. > > > > The procedure was to take a sequence of sequences like what "folder" would > > have when adding items to a TreeView, and go thru them to compute the > > correct > > positions to put those items into in a "horizontal" treeView. The procedure > > worked thru the items in a correct fashion, got to the last item just below > > the root item, knew it was where it should stop, but continues to maybe > > "unravel" previous left-over recursions, or something????? > > > > Is there some way to just STOP a procedure, even if it has been working > > recursivly?? Or maybe recursion is supposed to be limited to FUNCTIONS? > > > > > > procedure Help!() > > print(1,"help!") > > Help{} > > -- How can I stop!? > > end procedure > > > > Help! > > > > Dan > > > Hi Dan, > > Try please: > }}} <eucode> > procedure Help() > if get_key()!=-1 then return end if > print(1,"help!") > Help() > -- How can I stop!? > end procedure > Help() > </eucode> {{{ > > Regards, > Igor Kachan > kinz at peterlink.ru Thanks Igor, but I want the *procedure* to stop itself when it sees by test that it should be finished, not a user action stop it. eg:
procedure Help() print(1,"help!") Help() if getTime() = 6am then STOP! -- How can I let the procedure *stop itself*!? end if end procedure Help()
Dan
6. Re: How can I STOP a cursed recursion?
- Posted by Dan Moyer <danielmoyer at prodigy.net> Jun 19, 2006
- 557 views
ChrisBurch2 wrote: > > Hi > > Is your stop variable local or global - it needs to be global > > }}} <eucode> > integer stop_me > function foo() > > --do stuff > --result to break out > stop_me = 1 > > foo() > if stop_me = 1 then > > > end function > </eucode> {{{ Chris, I didn't DECLARE the stop variable as GLOBAL, but I did do it just like you did, with the stop variable outside and just before the PROCEDURE. I presume you were going to put a "return" inside the "if stop_me then", which is what I did do, but that is what isn't working. Not really knowing what I'm doing, I'm concerned that maybe recursive PROCEDURES are a no-no, that maybe they have to be FUNCTIONS??? Dan
7. Re: How can I STOP a cursed recursion?
- Posted by Juergen Luethje <j.lue at gmx.de> Jun 19, 2006
- 541 views
Dan Moyer wrote: <snip> > Is there some way to just STOP a procedure, even if it has been working > recursivly?? Yes, it is. > Or maybe recursion is supposed to be limited to FUNCTIONS? No. > procedure Help!() > print(1,"help!") > Help{} > -- How can I stop!? > end procedure > > Help!
integer Count, NumTimes procedure Help() puts(1,"Help!\n") Count += 1 if Count < NumTimes then Help() end if end procedure Count = 0 NumTimes = 3 Help()
The code above prints "Help!\n" three times. Often it is nice to use an additional non-recursive routine, which "wraps" the recursive routine, e.g.:
integer Count, NumTimes procedure Help() puts(1,"Help!\n") Count += 1 if Count < NumTimes then Help() end if end procedure global procedure Call_Help(integer times) -- This is the routine which is called by the user. Count = 0 NumTimes = times -- copy to local variable Help() end procedure Call_Help(3)
Regards, Juergen
8. Re: How can I STOP a cursed recursion?
- Posted by Ricardo M. Forno <rmforno at tutopia.com> Jun 19, 2006
- 539 views
Dan Moyer wrote: > > Igor Kachan wrote: > > > > Dan Moyer wrote: > > > > > > > > > With some difficulty, I built a recursive procedure, which seems to work > > > fine, except that I can't get it to STOP. > > > > > > It knows when it gets to where it should stop, & I put return in at that > > > point, & when that didn't work, I set an external variable to 1 > > > (=finished) > > > when it got to that point, and added a test at the beginning of the > > > procedure > > > to "return" if it saw that var "finished", but that didn't work either. > > > > > > The procedure was to take a sequence of sequences like what "folder" would > > > have when adding items to a TreeView, and go thru them to compute the > > > correct > > > positions to put those items into in a "horizontal" treeView. The > > > procedure > > > worked thru the items in a correct fashion, got to the last item just > > > below > > > the root item, knew it was where it should stop, but continues to maybe > > > "unravel" previous left-over recursions, or something????? > > > > > > Is there some way to just STOP a procedure, even if it has been working > > > recursivly?? Or maybe recursion is supposed to be limited to FUNCTIONS? > > > > > > > > > procedure Help!() > > > print(1,"help!") > > > Help{} > > > -- How can I stop!? > > > end procedure > > > > > > Help! > > > > > > Dan > > > > > > Hi Dan, > > > > Try please: > > }}} <eucode> > > procedure Help() > > if get_key()!=-1 then return end if > > print(1,"help!") > > Help() > > -- How can I stop!? > > end procedure > > Help() > > </eucode> {{{ > > > > Regards, > > Igor Kachan > > kinz at peterlink.ru > > Thanks Igor, but I want the *procedure* to stop itself when it sees by test > that it should be finished, not a user action stop it. > > eg: > }}} <eucode> > procedure Help() > print(1,"help!") > Help() > if getTime() = 6am then > STOP! -- How can I let the procedure *stop itself*!? > end if > > end procedure > Help() > </eucode> {{{ > > Dan Hi Dan. In any case, to stop a recursive procedure you must test its ending *before* calling it. If not, it will recurse forever, until it eats all available storage. Typical example (code not tested) function factorial (atom x) if x = 0 then return 1 end if return factorial(x - 1) * x end function
9. Re: How can I STOP a cursed recursion?
- Posted by Dan Moyer <danielmoyer at prodigy.net> Jun 19, 2006
- 550 views
Juergen Luethje wrote: > > Dan Moyer wrote: > > <snip> > > > Is there some way to just STOP a procedure, even if it has been working > > recursivly?? > > Yes, it is. > > > Or maybe recursion is supposed to be limited to FUNCTIONS? > > No. > > > procedure Help!() > > print(1,"help!") > > Help{} > > -- How can I stop!? > > end procedure > > > > Help! > > }}} <eucode> > integer Count, NumTimes > > procedure Help() > puts(1,"Help!\n") > Count += 1 > if Count < NumTimes then > Help() > end if > end procedure > > Count = 0 > NumTimes = 3 > Help() > </eucode> {{{ > > The code above prints "Help!\n" three times. Often it is nice to use an > additional non-recursive routine, which "wraps" the recursive routine, e.g.: > > }}} <eucode> > integer Count, NumTimes > > procedure Help() > puts(1,"Help!\n") > Count += 1 > if Count < NumTimes then > Help() > end if > end procedure > > global procedure Call_Help(integer times) > -- This is the routine which is called by the user. > Count = 0 > NumTimes = times -- copy to local variable > Help() > end procedure > > Call_Help(3) > </eucode> {{{ > > Regards, > Juergen Juergen, Ok, that looks somewhat promising. What I think you're saying is instead of trying to STOP the recursion, only ask that it be done again from within itself if some condition is met, ie, if it's not *finished* doing something. I'll give that a try after I get some sleep. Thanks! Dan
10. Re: How can I STOP a cursed recursion?
- Posted by Dan Moyer <danielmoyer at prodigy.net> Jun 19, 2006
- 564 views
Ricardo M. Forno wrote: > > Hi Dan. > In any case, to stop a recursive procedure you must test its ending *before* > calling it. If not, it will recurse forever, until it eats all available > storage. > Typical example (code not tested) > > function factorial (atom x) > if x = 0 then > return 1 > end if > return factorial(x - 1) * x > end function Hi Ricardo, Here's like what I did, except that I have a number of other tests inside the procedure which can re-call the procedue with different values to act on, (those tests & consequences DID work), but the STOPPING didn't work: integer STOP STOP = 0 procedure Help() if STOP then return end if print(1,"help!") Help() if getTime() = 6am then STOP = 1 -- How can I let the procedure *stop itself*!? end if end procedure Help() After I get some sleep, I'll try Juergen's suggestion, which I think is to only call the procedure from within itself when some "*not*-finished" condition is met, rather than trying to use "return" to STOP it when the finished condition *is* met. Thanks, Dan
11. Re: How can I STOP a cursed recursion?
- Posted by Dan Moyer <danielmoyer at prodigy.net> Jun 19, 2006
- 558 views
Dan Moyer wrote: > > Ricardo M. Forno wrote: > > > > Hi Dan. > > In any case, to stop a recursive procedure you must test its ending *before* > > calling it. If not, it will recurse forever, until it eats all available > > storage. > > Typical example (code not tested) > > > > function factorial (atom x) > > if x = 0 then > > return 1 > > end if > > return factorial(x - 1) * x > > end function > > Hi Ricardo, > > Here's like what I did, except that I have a number of other tests inside > the procedure which can re-call the procedue with different values to > act on, (those tests & consequences DID work), but the STOPPING didn't work: > > integer STOP > STOP = 0 > procedure Help() > if STOP then > return > end if > print(1,"help!") > Help() > if getTime() = 6am then > STOP = 1 -- How can I let the procedure *stop itself*!? > end if > > end procedure > Help() > > After I get some sleep, > I'll try Juergen's suggestion, which I think is to only call the procedure > from within itself when some "*not*-finished" condition is met, rather than > trying to use "return" to STOP it when the finished condition *is* met. > > Thanks, > Dan Ricardo, I see I should have paid more attention to what you said, because if my code really did what my example did, then the set STOP is never encountered. I'll have to look at my actual code closer in relation to what you said. Thanks, Dan
12. Re: How can I STOP a cursed recursion?
- Posted by Igor Kachan <kinz at peterlink.ru> Jun 19, 2006
- 553 views
Dan Moyer wrote: > > Igor Kachan wrote: > > > > Dan Moyer wrote: > > > > > > > > > With some difficulty, I built a recursive procedure, which seems to work > > > fine, except that I can't get it to STOP. > > > > > > It knows when it gets to where it should stop, & I put return in at that > > > point, & when that didn't work, I set an external variable to 1 > > > (=finished) > > > when it got to that point, and added a test at the beginning of the > > > procedure > > > to "return" if it saw that var "finished", but that didn't work either. > > > > > > The procedure was to take a sequence of sequences like what "folder" would > > > have when adding items to a TreeView, and go thru them to compute the > > > correct > > > positions to put those items into in a "horizontal" treeView. The > > > procedure > > > worked thru the items in a correct fashion, got to the last item just > > > below > > > the root item, knew it was where it should stop, but continues to maybe > > > "unravel" previous left-over recursions, or something????? > > > > > > Is there some way to just STOP a procedure, even if it has been working > > > recursivly?? Or maybe recursion is supposed to be limited to FUNCTIONS? > > > > > > > > > procedure Help!() > > > print(1,"help!") > > > Help{} > > > -- How can I stop!? > > > end procedure > > > > > > Help! > > > > > > Dan > > > > > > Hi Dan, > > > > Try please: > > }}} <eucode> > > procedure Help() > > if get_key()!=-1 then return end if > > print(1,"help!") > > Help() > > -- How can I stop!? > > end procedure > > Help() > > </eucode> {{{ > > > > Regards, > > Igor Kachan > > kinz at peterlink.ru > > Thanks Igor, but I want the *procedure* to stop itself when it sees by test > that it should be finished, not a user action stop it. > > eg: > }}} <eucode> > procedure Help() > print(1,"help!") > Help() > if getTime() = 6am then > STOP! -- How can I let the procedure *stop itself*!? > end if > > end procedure > Help() > </eucode> {{{ > > Dan Ok, no problem, try please:
integer n n=0 procedure Help() if n=5 then return end if puts(1,"help!") n+=1 Help() end procedure Help() atom T T=time() procedure Help_() if time()-T > 20 then return end if puts(1,"help!") Help_() end procedure Help_()
Regards, Igor Kachan kinz at peterlink.ru
13. Re: How can I STOP a cursed recursion?
- Posted by ChrisBurch2 <crylex at freeuk.co.uk> Jun 19, 2006
- 556 views
Hi Sorry, stuff got a bit garbled. I tend to use functions, because its easier to break out of a function than a procedure. This is the way I do it Generally you need a global indicator variable. This tells the loop, and all previous loop iterations to stop. An infinite loop within the procedure
integer break_free --this is global to the program break_free = 0 procedure foo() while 1 do if break_free = 1 then exit end if --do stuff --are conditions met to exit loop if conditions met then break_free = 1 end if foo() end while end procedure
Note the position of loop testing, and setting the global break free variable - if you've recursed (?) 10 times, then you exit the loop 10 times You must also reset break_free to 0 immediately after calling foo() for the first time Chris
14. Re: How can I STOP a cursed recursion?
- Posted by Pete Lomax <petelomax at blueyonder.co.uk> Jun 19, 2006
- 572 views
On Mon, 19 Jun 2006 06:33:36 -0700, Dan Moyer <guest at RapidEuphoria.com> wrote: >Is there some way to just STOP a procedure, even if it has been working >recursivly??
find(bed,house) sleep()
Seriously, I would make a very small test dataset and trace it. Regards, Pete
15. Re: How can I STOP a cursed recursion?
- Posted by Juergen Luethje <j.lue at gmx.de> Jun 19, 2006
- 595 views
Dan Moyer wrote: > Ricardo M. Forno wrote: > >> Hi Dan. >> In any case, to stop a recursive procedure you must test its ending *before* >> calling it. If not, it will recurse forever, until it eats all available >> storage. >> Typical example (code not tested) >> >> function factorial (atom x) >> if x = 0 then >> return 1 >> end if >> return factorial(x - 1) * x >> end function > > Hi Ricardo, > > Here's like what I did, except that I have a number of other tests inside > the procedure which can re-call the procedue with different values to > act on, (those tests & consequences DID work), but the STOPPING didn't work: > > integer STOP > STOP = 0 > procedure Help() > if STOP then > return > end if > print(1,"help!") > Help() > if getTime() = 6am then > STOP = 1 -- How can I let the procedure *stop itself*!? > end if > > end procedure > Help() > > After I get some sleep, > I'll try Juergen's suggestion, which I think is to only call the procedure > from within itself when some "*not*-finished" condition is met, rather than > trying to use "return" to STOP it when the finished condition *is* met. No, that's not the point. Previously I wrote ...
integer Count, NumTimes procedure Help() puts(1,"Help!\n") Count += 1 if Count < NumTimes then Help() end if end procedure Count = 0 NumTimes = 3 Help()
... but we can use as well:
integer Count, NumTimes procedure Help() puts(1,"Help!\n") Count += 1 if Count >= NumTimes then return end if Help() end procedure Count = 0 NumTimes = 3 Help()
Inspired by Ricardo's post, I see now that the same can be done without any local (or global) variable:
procedure Help(integer times) if times > 0 then puts(1,"Help!\n") Help(times-1) end if end procedure Help(3)
Or ...
procedure Help(integer times) if times <= 0 then return end if puts(1,"Help!\n") Help(times-1) end procedure Help(3)
Here is an Introduction to Recursion <http://personal.vsnl.com/erwin/recintro.htm>. Regards, Juergen -- Please excuse my flawed English. My native language is Euphoria.
16. Re: How can I STOP a cursed recursion?
- Posted by Al Getz <Xaxo at aol.com> Jun 20, 2006
- 559 views
Hi there Dan, As others have mentioned, all you need to do is have a 'test' within your procedure to make sure there is a true exit at some point in the execution...i think this will illustrate: constant Data={1,2,3,4,5,0} integer k k=0 procedure Help() k+=1 if Data[k]=0 then ?k return else Help() end if end procedure Help() The main idea is that the procedure checks some aspect of the data it's working on and makes a decision to either return or call another Help(). This of course means that that particular aspect of the data must be changing while in the procedure so that the procedure can make an intelligent decision on it's own, without outside help. The following routine would NOT work because it's data never changes: constant Data={1,2,3,4,5,0} integer k k=1 procedure Help() if Data[k]!=0 then Help() else return end if end procedure Help() Just a guess, but your routine may want to test to see if the next piece of data is a sequence or an atom, and take the appropriate actions. BTW, it's true that after a number of recurcive calls the code will 'unravel' by executing a whole bunch of 'return' statements, or perhaps just 'end procedure' a whole bunch of times, but only if it's designed right in the first place Take care, Al And, good luck with your Euphoria programming! My bumper sticker: "I brake for LED's" From "Black Knight": "I can live with losing the good fight, but i can not live without fighting it". "Well on second thought, maybe not."
17. Re: How can I STOP a cursed recursion?
- Posted by Dan Moyer <danielmoyer at prodigy.net> Jun 20, 2006
- 545 views
ChrisBurch2 wrote: > > Hi > > Sorry, stuff got a bit garbled. > > I tend to use functions, because its easier to break out of a function than > > a procedure. > > This is the way I do it > > Generally you need a global indicator variable. This tells the loop, and all > previous loop iterations to stop. > > An infinite loop within the procedure > > }}} <eucode> > integer break_free --this is global to the program > break_free = 0 > > procedure foo() > > while 1 do > if break_free = 1 then > exit > end if > > --do stuff > > --are conditions met to exit loop > if conditions met then > break_free = 1 > end if > > foo() > > end while > > > end procedure > > </eucode> {{{ > > Note the position of loop testing, and setting the global break free > variable - if you've recursed (?) 10 times, then you exit the loop 10 times > > You must also reset break_free to 0 immediately after calling foo() for the > first time > > Chris Chris, I must have done something like what you said, because I DID GET MY RECURSION TO STOP, and I did have a while-loop in it that might have been at least part of the problem. I left a message here just about the time you wrote the above, to let people know that with all of your help the problem was solved, BUT IT DIDN'T GET POSTED. And about 15 minutes or so ago I resent a similar message, when I finally saw that the earlier one never made it here, and THAT ONE never has shown up either. I'm hoping this will show up on the forum so all who replied to my question will know IT'S SOLVED (as far as I can tell), and that I'm grateful for the help. Thanks, Dan
18. Re: How can I STOP a cursed recursion?
- Posted by don cole <doncole at pacbell.net> Jun 22, 2006
- 533 views
Hello everybody, My computer has been broken for about a week. I guess nobody missed me. I've been catching up on my Euforum reading. I've seen a lot of talk about the code, procedure Help() help() end procedure If this code is not illegal it should be. How can you call a procedure from within this procedure? I find this code very disturbing as it goes against all the rules. One should be able to call help() from any number of places besides help it self. And lastly I don't see any point of doing that way. Don Cole
19. Re: How can I STOP a cursed recursion?
- Posted by Al Getz <Xaxo at aol.com> Jun 22, 2006
- 537 views
don cole wrote: > > Hello everybody, > > My computer has been broken for about a week. I guess nobody missed me. > I've been catching up on my Euforum reading. I've seen a lot of talk about > the code, > > procedure Help() > help() > end procedure > > If this code is not illegal it should be. How can you call a procedure from > within this procedure? I find this code very disturbing as it goes against all > the rules. One should be able to call help() from any number of places besides > help it self. And lastly I don't see any point of doing that way. > > Don Cole Hi there Don, A week isnt that long on this list, but if you were gone a month im sure we all would have missed you. Calling a function from within itself is called 'recursion' and was an important part of programming...not sure if it is anymore, but some things are just neater to do using this kind of programming. It also means the execution not only depends on the instructions in the source code but also depends on the data at run time. I think Rob said one time that Euphoria uses a dynamic stack that can grow as need arises, so that even with a large number of recursions deeply nested we wont run out of stack space. Take care, Al And, good luck with your Euphoria programming! My bumper sticker: "I brake for LED's" From "Black Knight": "I can live with losing the good fight, but i can not live without fighting it". "Well on second thought, maybe not."
20. Re: How can I STOP a cursed recursion?
- Posted by Dan Moyer <danielmoyer at prodigy.net> Jun 22, 2006
- 553 views
don cole wrote: > > Hello everybody, > > My computer has been broken for about a week. I guess nobody missed me. > I've been catching up on my Euforum reading. I've seen a lot of talk about > the code, > > procedure Help() > help() > end procedure > > If this code is not illegal it should be. How can you call a procedure from > within this procedure? I find this code very disturbing as it goes against all > the rules. One should be able to call help() from any number of places besides > help it self. And lastly I don't see any point of doing that way. > > Don Cole Don, Why do you think I called it "cursed" recursion, heh heh! But in fact some things can be done "more elegently" by recursion (or with much fewer lines of code), and I think some things may be nearly impossible (?) to do without recursion. I definatly wouldn't have used it if I had thought I could use some other method instead!! Here is an Introduction to Recursion that Juergen provided: <http://personal.vsnl.com/erwin/recintro.htm>. btw, people were kind enough to not even mention my error in my example, & some just corrected it. should be:
procedure Help() Help() -- since help() would be another procedure entirely end procedure
and of course, THIS example would just run forever or until it crashed the system or something, which was in fact my original problem, making it STOP! Take care, Dan
21. Re: How can I STOP a cursed recursion?
- Posted by Craig Welch <euphoria at cwelch.org> Jun 22, 2006
- 548 views
Dan Moyer wrote: > Here is an Introduction to Recursion that Juergen provided: > <http://personal.vsnl.com/erwin/recintro.htm>.\ Good stuff there, but the definition of recursion is a bit long. I prefer the following: Recursion - see recursion. -- Craig
22. Re: How can I STOP a cursed recursion?
- Posted by Ricardo M. Forno <rmforno at tutopia.com> Jun 22, 2006
- 605 views
don cole wrote: > > Hello everybody, > > My computer has been broken for about a week. I guess nobody missed me. > I've been catching up on my Euforum reading. I've seen a lot of talk about > the code, > > procedure Help() > help() > end procedure > > If this code is not illegal it should be. How can you call a procedure from > within this procedure? I find this code very disturbing as it goes against all > the rules. One should be able to call help() from any number of places besides > help it self. And lastly I don't see any point of doing that way. > > Don Cole Hi, Don. Recursion is not only an elegant form of programming some tasks, but sometimes it is badly needed. It can be shown that what you do by means of recursion can be done in another way, but sometimes things may become very difficult in this "other way". The typical example is (code not tested): (a should be an integer, but the result may be too large to fit into an integer) function factorial(atom a) if a = 0 then return 1 end if return a * factorial(a - 1) end function This can be done without recursion: function factorial(atom a) atom r r = 1 for i = 2 to a do r = r * i end for return r end function This is a bit longer than the recursive version, but this does not show the real benefits of recursion. You will find more useful examples of recursion in my General Functions contributed program, or in my recently updated General Sudoku program. In this last program, it will be difficult to process an undefined number of dimensions without using recursion. Regards.