From: Kristof Bastiaensen Date: 2006-08-03T23:25:06+09:00 Subject: Re: For performance, write it in OCaml On Thu, 03 Aug 2006 21:59:40 +0900, Peter Hickman wrote: > Jon Harrop wrote: >> Peter Hickman wrote: >> >>> I will take the revised Ocaml version and time it and check the output >>> tonight. >>> >>> >> Yeah. I didn't bother doing that. ;-) >> >> > Not wanting to name and shame but there was one submission (off list) > that was faster for completely the wrong reasons. Besides I get a warm > fuzzy feeling when the results match because the pain of checking which > program is actually wrong is too great. As my Perl, Java and C versions > all use the same Perl to pre compute their values they all produced the > same results, consistent yes but are they correct? I'm pretty confident > now, especially now that I have independently written programs produce > the same results. > > I used the following tests: "ruby latin.rb | wc -l" to test if the number of squares matches the number that is written in the wikipedia article. Then "ruby latin.rb | sort | uniq | wc -l" shows if all the squares that are output by the program are different. All that remains to be done is to check that each latin square is actually a latin square. That wouldn't be so much work, but I just looked at some of the output, and trusted that the rest of the squares are correct too :) Regards, Kristof