in reply to Re^2: Tail recursion elimination
in thread Tail recursion elimination
You appear to have misunderstood. I didn't say that eliminating recursion was bad, I said that using goto &{...} nearly always is. There are probably better ways to do this in perl but one of the "best" ways I know of is to just go back to the top of the routine after setting @_ with the new args. For short routines and such.
sub foo { { ... # Recurse but without actually calling foo() again. @_ = ...; redo; } }
I also expect that there are better ways to save on memory than eliminating stack frames.
⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Tail recursion elimination
by billh (Pilgrim) on Apr 28, 2006 at 20:27 UTC |