Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <alphamule> "<PlanckWalk> Obviously any recursive algorithm can be implemented iteratively" Isn't that actually a third class: until/while loops with a sentinal? I mean, doesn't that contradict completeness theorem?
- <alphamule> I mean, a for loop should always return if it's at the lowest level (assuming classical 'summation' concept of k = a to b).
- <alphamule> Which implies it's definitely not complete.
- <alphamule> Now, you can cheat and use something like "break" and make k = 1 to infinity or something stupid. :P
- <alphamule> But that just turns it into a sentinal.
- <alphamule> That line does literally the same thing that C-like languages do when you have a condition check.
- <alphamule> Just moves it around.
- <alphamule> Halting Problem/Turing completeness relationship
- <okuu> alphamule: You are making even less sense than usual, I'm afraid. The translation between recursive procedures and imperative iteration (in either direction) is not only feasible - it is routine. Compilers do it.
- <dude12312414> it's not necessarily clear when a for or while loop terminates
- <dude12312414> so this does not contradict the Halting problem
- <okuu> It is similarly not necessarily clear when a recursive procedure terminates. :-|
- <dude12312414> true
- <okuu> And what does termination have to do with this anyway?
- <alphamule> "Compilers do it" bullshit
- <alphamule> The C-style 'for' loops are a poor example syntax.
- <alphamule> It is guarenteed that a loop of finite number of steps per iteration will halt if there's a finite number of loop iterations. This is not the same thing.
- <alphamule> nvm
- <alphamule> It's not like they're different or something.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement