Advertisement
Guest User

Untitled

a guest
Dec 16th, 2018
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 KB | None | 0 0
  1. <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?
  2. <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).
  3. <alphamule> Which implies it's definitely not complete.
  4. <alphamule> Now, you can cheat and use something like "break" and make k = 1 to infinity or something stupid. :P
  5. <alphamule> But that just turns it into a sentinal.
  6. <alphamule> That line does literally the same thing that C-like languages do when you have a condition check.
  7. <alphamule> Just moves it around.
  8. <alphamule> Halting Problem/Turing completeness relationship
  9. <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.
  10. <dude12312414> it's not necessarily clear when a for or while loop terminates
  11. <dude12312414> so this does not contradict the Halting problem
  12. <okuu> It is similarly not necessarily clear when a recursive procedure terminates. :-|
  13. <dude12312414> true
  14. <okuu> And what does termination have to do with this anyway?
  15. <alphamule> "Compilers do it" bullshit
  16. <alphamule> The C-style 'for' loops are a poor example syntax.
  17. <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.
  18. <alphamule> nvm
  19. <alphamule> It's not like they're different or something.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement