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
weiq...@gmail.com
http://www.weiqigao.com/blog/
shorter and also burns cycles ;-)
Kirk
> --
> You received this message because you are subscribed to the Google Groups "The Java Posse" group.
> To post to this group, send email to java...@googlegroups.com.
> To unsubscribe from this group, send email to javaposse+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/javaposse?hl=en.
>
while(true) {} // less steps, same number of characters and cycles,
eat it BIATCH!
--
Joseph B. Ottinger
http://enigmastation.com
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
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.
Kirk
#!/bin/bash
function f() {
sleep "$1"
echo "$1"
}
while [ -n "$1" ]
do
f "$1" &
shift
done
wait
./sleepsort.bash 5 3 6 3 6 3 1 4 7
Sunday Sept. 18th through Tuesday Sept. 20th, 2011
https://thestrangeloop.com/news/11/01/27/strange-loop-2011
https://thestrangeloop.com/
(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
> >>>>> weiq...@gmail.com <mailto:weiq...@gmail.com>
> >>>>> http://www.weiqigao.com/blog/
I knew exactly what you were doing when I saw it - I had a bug like that when I was first learning C, except the "i" variable in this case was in the main, and the array was in a function - I overshot the end of the array, and wrote a newline onto the i character. Took me an hour to figure out why I was always getting 48 as the value of i... was trying to debug the main, but the problem was in the function... :)
--
You received this message because you are subscribed to the Google Groups "The Java Posse" group.
To view this discussion on the web visit https://groups.google.com/d/msg/javaposse/-/OQDvs9QTYoIJ.
To post to this group, send email to java...@googlegroups.com.
To unsubscribe from this group, send email to javaposse+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/javaposse?hl=en.
I can only assume that you are from the future and reporting on COBOL THREE, known colloquially as Java.Next. It is reported to be the 4th language to, on its deathbed, exclaim "Ok, I give in, you can have lambdas!".