Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

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]
[Corion]: Whoops - more spam - I guess I'll have to collate a list and have them banned later today
[Corion]: Maybe I should bring my Github credentials to $work some day, just to open issues for ;)

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (6)
As of 2017-02-24 11:52 GMT
Find Nodes?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?

    Results (354 votes). Check out past polls.