• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

not using any loops

 
Anupam Sinha
Ranch Hand
Posts: 1090
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know whether I should ask this question here or in some other forum. One day me and my friend were thinking as to whether there is any way we can have the loop effect(doing things continously till a point) without using loops. One solution we came up with was the use of goto but that's not won't do the trick incase of java. Other solution that we thought was using recursive methods. I wonder is there any other way to achieve the same result. The method need not be efficent. But no importing of any classes is allowed except those implictly imported. Or would importing classes really make any difference if the imported classes also don't use loops for doing things repeatedly. The use of native methods is also not allowed. I guess that may also work. I am not sure about it never used them fully. Please do also comment whether importing classes make any difference and using native methods.
[ June 27, 2003: Message edited by: Anupam Sinha ]
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You mean something like this?
 
Anupam Sinha
Ranch Hand
Posts: 1090
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thnaks Michael for the link. Yes this is what I actually wanted.
 
David Weitzman
Ranch Hand
Posts: 1365
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
With lambda calculus you can do anything a Turing machine can even though there's no concept of a loop. Unfortunately it can cause your brain to hurt at times. I'm not sure what it would take to simulate lambda calculus in Java (perhaps just some really clever use of anonymous inner classes?).
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's a perverse little class that will do the HelloWorld100 deal. I'm not sure if anyone posted something similar.
NoLoopLooper.java

HelloWorld100.java
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic