[The Java Posse] Re: Post your strangest loop and win (up to) 4 free passes to Strange Loop!

2010-09-07 Thread Bill Robertson
I'd like to thank the Alex for the ticket, the Posse for judging and all of the hard work they do (seriously, thanks guys), Kevin, and last but not least Nicholas Forth, inventor of the for loop. On Sep 5, 6:32 pm, Kevin Wright wrote: > Just listened to the results in podcast #322 (hereafter to

[The Java Posse] Re: Post your strangest loop and win (up to) 4 free passes to Strange Loop!

2010-09-05 Thread Christian Catchpole
These 9 characters are great for producing carbon... for(;;){} -- You received this message because you are subscribed to the Google Groups "The Java Posse" group. To post to this group, send email to javapo...@googlegroups.com. To unsubscribe from this group, send email to javaposse+unsub

[The Java Posse] Re: Post your strangest loop and win (up to) 4 free passes to Strange Loop!

2010-09-05 Thread Alex
Congrats guys! I'll follow up with the winners. Alex Miller http://strangeloop2010.com On Sep 5, 5:32 pm, Kevin Wright wrote: > Just listened to the results in podcast #322 (hereafter to be known as "the > epic") > And the winners were: > > #1 Joseph Darcy > #2 Curt Cox > #3 Me! > #4 Bill Robe

Re: [The Java Posse] Re: Post your strangest loop and win (up to) 4 free passes to Strange Loop!

2010-09-05 Thread Kevin Wright
Just listened to the results in podcast #322 (hereafter to be known as "the epic") And the winners were: #1 Joseph Darcy #2 Curt Cox #3 Me! #4 Bill Robertson I'd love to go, but find myself to be living on the wrong continent... Enjoy your ticket Bill! -- Kevin Wright mail / gtalk / msn : k

[The Java Posse] Re: Post your strangest loop and win (up to) 4 free passes to Strange Loop!

2010-08-10 Thread Niels Ull
public class Main { public static void main(String[] args) throws IOException { String msg = "Hello "; List strings = new ArrayList(Arrays.asList(args)); try { String s = strings.remove(0); for (int i = 0; i >= 0; i++) { msg += s.t

[The Java Posse] Re: Post your strangest loop and win (up to) 4 free passes to Strange Loop!

2010-08-09 Thread Bill Robertson
A fun one. for(long t = 0; t < System.currentTimeMillis(); ++t) { } -- You received this message because you are subscribed to the Google Groups "The Java Posse" group. To post to this group, send email to javapo...@googlegroups.com. To unsubscribe from this group, send email to javaposse+unsu

Re: [The Java Posse] Re: Post your strangest loop and win (up to) 4 free passes to Strange Loop!

2010-08-05 Thread Alexey Zinger
Surely we can figure something out with runtime bytecode emission... From: Quoll To: The Java Posse Sent: Wed, August 4, 2010 12:20:32 PM Subject: [The Java Posse] Re: Post your strangest loop and win (up to) 4 free passes to Strange Loop! I'd love to

[The Java Posse] Re: Post your strangest loop and win (up to) 4 free passes to Strange Loop!

2010-08-05 Thread Heath
Duff's Device is my favorite. If someone knows how to make this infinite, I'm eager to hear. -Heath import java.io.File; import java.net.URL; import java.net.URLClassLoader; public class StackOverflow { static { try { Class.forName(StackOverflow.c

Re: [The Java Posse] Re: Post your strangest loop and win (up to) 4 free passes to Strange Loop!

2010-08-05 Thread Josh Suereth
Taken from: http://www.scala-lang.org/api/current/scala/collection/immutable/Stream.html def from(n: Int): Stream[Int] = Stream.cons(n, from(n + 1)) // Here's the loop... def sieve(s: Stream[Int]): Stream[Int] = Stream.cons(s.head, sieve(s.tail filter { _ % s.head != 0 }))

[The Java Posse] Re: Post your strangest loop and win (up to) 4 free passes to Strange Loop!

2010-08-05 Thread Reinier Zwitserloot
That'll replace spaces in string literals as well. On Aug 4, 9:43 pm, Kyle Renfro wrote: > Great contest! > 1 pass required. > > Here is a very handy loop that *everyone* should use. ha ha. > > import java.io.*; > import java.util.logging.*; > > public class AddTabs { > >     public static void m

Re: [The Java Posse] Re: Post your strangest loop and win (up to) 4 free passes to Strange Loop!

2010-08-05 Thread Viktor Klang
ps.com] > > Namens Kyle Renfro > > Verzonden: 04 August 2010 21:43 > > Aan: The Java Posse > > Onderwerp: [The Java Posse] Re: Post your strangest loop and > > win (up to) 4 free passes to Strange Loop! > > > > Great contest! > > 1 pass requir

RE: [The Java Posse] Re: Post your strangest loop and win (up to) 4 free passes to Strange Loop!

2010-08-05 Thread Roel Spilker
Did you use a regular expression on purpose? > -Oorspronkelijk bericht- > Van: kyleren...@gmail.com [mailto:javapo...@googlegroups.com] > Namens Kyle Renfro > Verzonden: 04 August 2010 21:43 > Aan: The Java Posse > Onderwerp: [The Java Posse] Re: Post your strangest l

Re: [The Java Posse] Re: Post your strangest loop and win (up to) 4 free passes to Strange Loop!

2010-08-04 Thread JamesJ
Here is one that stuck in my memory. I worked with a brilliant guy that could solve problems in about any domain electrical, mechanical etc. When ever he programed in C he would check the compiler he was using to see what op codes it was generating. He was always programming a layer deeper that

[The Java Posse] Re: Post your strangest loop and win (up to) 4 free passes to Strange Loop!

2010-08-04 Thread Quoll
Well, it makes some possibly invalid assumptions, but here's one possible loop. import java.io.*; public class Loop { public static void main(String[] a) throws Exception { if (a.length == 0) a = new String[]{"Hello World!"}; if (a[0].length() == 1) System.out.println(a[0].charAt(0));

[The Java Posse] Re: Post your strangest loop and win (up to) 4 free passes to Strange Loop!

2010-08-04 Thread Quoll
On Aug 4, 1:05 pm, Scott Bale wrote: > I once got "bit by byte" in the following loop: > > for(byte a=Byte.MIN_VALUE; a<=Byte.MAX_VALUE; a++) { >   for(byte b=Byte.MIN_VALUE; b<=Byte.MAX_VALUE; b++) { >     byte[] test = new byte[] { a, b}; >     //do something... >   } > > } > > When I ran this,

[The Java Posse] Re: Post your strangest loop and win (up to) 4 free passes to Strange Loop!

2010-08-04 Thread Kyle Renfro
Great contest! 1 pass required. Here is a very handy loop that *everyone* should use. ha ha. import java.io.*; import java.util.logging.*; public class AddTabs { public static void main(String[] args){ try { BufferedReader in = new BufferedReader(new InputStreamReader(S

[The Java Posse] Re: Post your strangest loop and win (up to) 4 free passes to Strange Loop!

2010-08-04 Thread Scott Bale
I once got "bit by byte" in the following loop: for(byte a=Byte.MIN_VALUE; a<=Byte.MAX_VALUE; a++) { for(byte b=Byte.MIN_VALUE; b<=Byte.MAX_VALUE; b++) { byte[] test = new byte[] { a, b}; //do something... } } When I ran this, CPU shot to 100% and I had to take down Eclipse with extre

[The Java Posse] Re: Post your strangest loop and win (up to) 4 free passes to Strange Loop!

2010-08-04 Thread Quoll
Well if "famous" loops that we're not writing ourselves are being mentioned (eg. Duff's Device) then how could I not mention the loop written by Mel Kaye on the RPC-4000? For those not familiar with the story, see: http://catb.org/jargon/html/story-of-mel.html Kaye wrote a loop that had no termi

Re: [The Java Posse] Re: Post your strangest loop and win (up to) 4 free passes to Strange Loop!

2010-08-04 Thread Dominic Mitchell
On Tue, Aug 3, 2010 at 6:23 PM, Alex wrote: > The deadline for the contest will be Aug. 31st! Give us your loops! > Sadly, I can't take credit for it, but I noticed this gem fly through my feed reader this morning. http://www.daemonology.net/blog/2010-08-02-neverending-finite-loop.html The (C

Re: Java vs Scala specs was Re: [The Java Posse] Re: Post your strangest loop and win (up to) 4 free passes to Strange Loop!

2010-08-04 Thread Kevin Wright
Right :) Unlike the original Java, it's open source - so if anyone wanted to add features to scalac, they'd be more likely to fork it than to start from scratch working against the spec. Even that is highly unlikely because: 1. scalac has a plugin mechanism for extending/changing functionality

Java vs Scala specs was Re: [The Java Posse] Re: Post your strangest loop and win (up to) 4 free passes to Strange Loop!

2010-08-04 Thread Fabrizio Giudici
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 8/4/10 17:09 , Kevin Wright wrote: > I actually got the numbers wrong here. although the final page has > 649 printed on it, acrobat informs me that the document is in fact > 684 pages long, > > Java (3rd Edition): 684 pages, 7932 KB Scala (current

Re: [The Java Posse] Re: Post your strangest loop and win (up to) 4 free passes to Strange Loop!

2010-08-04 Thread Kevin Wright
I actually got the numbers wrong here. although the final page has 649 printed on it, acrobat informs me that the document is in fact 684 pages long, Java (3rd Edition): 684 pages, 7932 KB Scala (current in trunk): 191 pages, 1312 KB Why would this be so? I can think of a few reasons: - Java

Re: [The Java Posse] Re: Post your strangest loop and win (up to) 4 free passes to Strange Loop!

2010-08-04 Thread Robert Casto
Going back to what this thread is about, you could post a better strange loop or... Sign up to be a volunteer. They are looking for 8-10 people to help out. http://strangeloop2010.com/pages/volunteers On Wed, Aug 4, 2010 at 10:57 AM, Viktor Klang wrote: > > > On Wed, Aug 4, 2010 at 4:26 PM, Rei

Re: [The Java Posse] Re: Post your strangest loop and win (up to) 4 free passes to Strange Loop!

2010-08-04 Thread Viktor Klang
On Wed, Aug 4, 2010 at 4:26 PM, Reinier Zwitserloot wrote: > I really like how folks keep making the argument that java sucks > because it is *well documented*. That made me laugh. What an euphemism! :D > Only a scala fanboy would go that far. > > > > > On Aug 4, 11:01 am, Kevin Wright wrote

[The Java Posse] Re: Post your strangest loop and win (up to) 4 free passes to Strange Loop!

2010-08-04 Thread Reinier Zwitserloot
I really like how folks keep making the argument that java sucks because it is well documented. Only a scala fanboy would go that far. On Aug 4, 11:01 am, Kevin Wright wrote: > my thinking: > > `http:` is the label (followed by a comment that the pre-processor strips > out) > `do { ... } while

[The Java Posse] Re: Post your strangest loop and win (up to) 4 free passes to Strange Loop!

2010-08-04 Thread Reinier Zwitserloot
Yes, Mark, it does. C works in mysterious ways, and this is just one in a long, possibly endless, procession of them. Duff's device is one of those hallowed "WTF? Oh.. Ooooh! I get it! Whoever cooked this up is an evil genius!!!" optimizations useful in the early days of computing. The wikipedia pa

Re: [The Java Posse] Re: Post your strangest loop and win (up to) 4 free passes to Strange Loop!

2010-08-04 Thread Fabrizio Giudici
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 8/4/10 11:01 , Kevin Wright wrote: > > For anyone still labouring under the delusion that Java is a > simple language, it's a heavyweight document; running to 650 pages > in almost 8MB but you only really need chapter 14 for this question > :) > Ab

Re: [The Java Posse] Re: Post your strangest loop and win (up to) 4 free passes to Strange Loop!

2010-08-04 Thread Steven Siebert
I tried to go for a strange "Strange loop" ( http://en.wikipedia.org/wiki/Strange_loop)...but I ended up with a recursive loop of doom. Please forgive the quick thrown-together implementation =) (2 passes, please =) Given a "normal" string, this app would loop through and resolve the acronym wit

Re: [The Java Posse] Re: Post your strangest loop and win (up to) 4 free passes to Strange Loop!

2010-08-04 Thread Kevin Wright
my thinking: `http:` is the label (followed by a comment that the pre-processor strips out) `do { ... } while (...)` is the labelled statement `continue ` attempts to transfer control back to the "continue target". In this case, the labelled do/while loop a `do {statement} while (expression)` lo

Re: [The Java Posse] Re: Post your strangest loop and win (up to) 4 free passes to Strange Loop!

2010-08-03 Thread Mark Derricutt
Or a stack blowout? Just having a discussion in the office about whether or not the continue will leave a nested stack of do's in the stack.. -- Pull me down under... On Wed, Aug 4, 2010 at 4:43 PM, Kirk wrote: > Puzzler, infinite loop or normal termination? > -- You received this message

Re: [The Java Posse] Re: Post your strangest loop and win (up to) 4 free passes to Strange Loop!

2010-08-03 Thread Kirk
I'll be speaking there so I don't need a pass but thought it might be fun to put in a puzzler. public class StrangeLoop { public static void main(String[] args) { http://www.thestrangeloop.com do { System.out.println("Strange Loop"); continue http;

[The Java Posse] Re: Post your strangest loop and win (up to) 4 free passes to Strange Loop!

2010-08-03 Thread Mac
here is my entry (defn pure-loop [n] (println "pure " n) (if (= n 0) 0 #(danger-loop (dec n (defn danger-loop [n] (println "danger " n) (if (= n 0) 0 #(pure-loop (dec n user=> (trampoline pure-loop 20) pure 20 danger 19 pure 18 danger 17 pure 16 danger 15

Re: [The Java Posse] Re: Post your strangest loop and win (up to) 4 free passes to Strange Loop!

2010-08-03 Thread Mark Derricutt
Does this even compile? As you have the do {} inside the first case statement, and all other case's are inside the do. Since there's not in scope of the case I'd expect this to fail? But then - I'm no C/C++ guy so who knows what wacky hackery they get up to :) -- Pull me down under... O

Re: [The Java Posse] Re: Post your strangest loop and win (up to) 4 free passes to Strange Loop!

2010-08-03 Thread Kevin Wright
For wacky loop madness, it doesn't get much stranger than loop unrolling in C/C++ So I present to you... ...Duff's Device! (lifted direct from Wikipedia) send(to, from, count)register short *to, *from;register count;{ register n=(count+7)/8; switch(count%8){ case 0: do{

[The Java Posse] Re: Post your strangest loop and win (up to) 4 free passes to Strange Loop!

2010-08-03 Thread Vince O'Sullivan
for (Strange loop : loops) if (loop.isStrange()) continue; On Aug 3, 6:23 pm, Alex wrote: > The deadline for the contest will be Aug. 31st!  Give us your loops! > > Alex -- You received this message because you are subscribed to the Google Groups "The Java Posse" group. To post to

[The Java Posse] Re: Post your strangest loop and win (up to) 4 free passes to Strange Loop!

2010-08-03 Thread Alex
The deadline for the contest will be Aug. 31st! Give us your loops! Alex -- You received this message because you are subscribed to the Google Groups "The Java Posse" group. To post to this group, send email to javapo...@googlegroups.com. To unsubscribe from this group, send email to javaposs

[The Java Posse] Re: Post your strangest loop and win (up to) 4 free passes to Strange Loop!

2010-08-03 Thread Matt Passell
If I were to win, I'd only need one ticket. I'm not sure if this counts (it might be more appropriate for the Daily WTF), but I once saw Java code that looked like the following (I don't remember what was inside the if blocks): for (int i = 0; i < 4; i++) { if (i == 0) { //some code to hand