Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re: Recurse using goto; Bug?

by wade (Pilgrim)
on Jul 18, 2008 at 21:14 UTC ( #698739=note: print w/replies, xml ) Need Help??

in reply to Recurse using goto; Bug?

That's interesting. In neither place do I find a terminating condition for the recursion so, theoretically, they both should run forever.

I have a separate question -- if you're going to use tail-recursion, anyway, why don't you just use iteration? If I understand things, correctly, you can only do tail-recursion with the 'goto &label' method.

Update: I added some clarification.


Replies are listed 'Best First'.
Re^2: Recurse using goto; Bug?
by ikegami (Pope) on Jul 18, 2008 at 22:05 UTC

    The issue wasn't whether it will run forever or not, but whether it would run out of memory or not. The OP is of the opinion that the memory usage of both snippets should be constant, while it's only the case for the second snippet.

      You're absolutely right, of course. The two should be identical. As it is, one of the snippets is silly and the other is silly and sucks up all memory. I sit, corrected. 8o).


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://698739]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2018-02-22 11:51 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (291 votes). Check out past polls.