A program in the same vein, but in Scheme (definitely a non-Java language):

(letrec ((f (lambda ()
              (f))))
  (f))

which, if you don't count the parentheses, is quite short.

Unlike its Java counterpart, any self-respecting properly tail-recursive Scheme implementation will run this infinite loop indefinitely without blowing the stack.

Just don't run this program while in a quite meeting, or the fan will kick on and the presenter will ask "Is an airplane taking off?"

--
Weiqi

On 06/17/2011 12:14 PM, Cédric Beust ♔ wrote:
void foo() {
   try {}
   finally { foo(); }
}

I wish I could take credit for this but it's actually code that I saw on
irc not long ago.

--
Cédric




On Fri, Jun 17, 2011 at 6:32 AM, Kirk <kirk.pepperd...@gmail.com
<mailto:kirk.pepperd...@gmail.com>> wrote:

    good one!!! I considers for(;;) {} but I wasn't sure what the
    conditional would be.

    Kirk

    On Jun 17, 2011, at 3:25 PM, Ricky Clarkson wrote:

     > <caine>Not many people know this</caine>, but:
     >
     > throw null; is valid Java, Scala and C#.
     >
     > The above is the one use of XML I wouldn't mind seeing in 20
    years time.
     >
     > On Fri, Jun 17, 2011 at 10:22 AM, Jonathan Fuerth
    <fue...@fuerth.ca <mailto:fue...@fuerth.ca>> wrote:
     >> If shorter is indeed stranger and C "Isn't Java," I can one-up Kirk:
     >>
     >> for (;;);
     >>
     >> Or
     >>
     >> GOTO: goto GOTO;
     >>
     >> (But of course this second one doesn't also work in Java, so
    it's hardly
     >> pushing the rules. Where's the fun in that?)
     >>
     >> -Jonathan
     >>
     >> On Jun 17, 2011 8:32 AM, "Joseph Ottinger"
    <j...@enigmastation.com <mailto:j...@enigmastation.com>> wrote:
     >>> And burns way more!
     >>>
     >>> while(true) {} // less steps, same number of characters and cycles,
     >>> eat it BIATCH!
     >>>
     >>> On Fri, Jun 17, 2011 at 8:23 AM, Kirk
    <kirk.pepperd...@gmail.com <mailto:kirk.pepperd...@gmail.com>> wrote:
     >>>> for (;true;) {}
     >>>>
     >>>> shorter and also burns cycles ;-)
     >>>>
     >>>> Kirk
     >>>>
     >>>> On Jun 17, 2011, at 2:12 PM, Weiqi Gao wrote:
     >>>>
     >>>>> I just finished listening to #354, in which Dick Wall calls
    for another
     >>>>> round of the Strangest Loop Competition to win tickets to the
    Strange Loop
     >>>>> 2001 Conference in St. Louis, MO, USA.
     >>>>>
     >>>>> The stipulation this year is that the loop must be in a
    language other
     >>>>> than Java.
     >>>>>
     >>>>> Here's my entry (it won't be the strangest for sure) to get
    the balls
     >>>>> rolling.  It's a loop in C++:
     >>>>>
     >>>>>  for (int i = 0; i < 10; i++) {}
     >>>>>
     >>>>> It doesn't do anything except to burn cycles, but it is a
    loop in a
     >>>>> language other than Java.  ;)
     >>>>>
     >>>>> --
     >>>>> Weiqi Gao
     >>>>> weiqi...@gmail.com <mailto:weiqi...@gmail.com>
     >>>>> http://www.weiqigao.com/blog/
     >>>>>
     >>>
     >>> --
     >>> Joseph B. Ottinger
     >>> http://enigmastation.com

--
You received this message because you are subscribed to the Google Groups "The Java 
Posse" group.
To post to this group, send email to javaposse@googlegroups.com.
To unsubscribe from this group, send email to 
javaposse+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/javaposse?hl=en.

Reply via email to