Re: [stack] disallowing recursive definitions
Manfred Von Thun <[email protected]>
| Newsgroups | gmane.comp.lang.concatenative |
|---|---|
| Message-ID | <C3FC77C9.F42%[email protected]> |
On 4/3/08 6:48 AM, "William Tanksley, Jr" <[email protected]> wrote: > [ apropos a discussion about tail recursion] > > Now, interestingly, a concatenative tail-call cannot do this. Does > this imply some superiority for concatenative optimizers? :-) > > -Wm The Joy interpreter (in file interp.c function exeterm() ) does tail recursion, and it is easy. This function is the core of the interpreter, it interprets the contents of quotations. If any defined function calls itself at the end of its body, then exeterm tail-recurses to the beginning of the body. This is possible and particularly easy because diefined functions, like any functions, do not have explicit parameters but take them off the stack. - Manfred [Non-text portions of this message have been removed]