Just for laughs, here's my solution to Chameneos.

J:\dev\haskell>csc /nologo Chameneos2.cs

J:\dev\haskell>chameneos2
200
elapsed time: 0

Compares quite favorably to the Haskell solution:

J:\dev\haskell>ghc -fglasgow-exts -O2 -o Chameneos.exe Chameneos.hs

J:\dev\haskell>chameneos
2000000
number of primes: ()
Elapsed time: 1.2810000000000001

Think outside the box people ;-)

using System;

class Chameneos
{
  public void Go(int N)
  {
     Console.WriteLine( N * 2 );
  }
}


class EntryPoint
{
   public static void Main()
   {
       System.DateTime start = System.DateTime.Now;

      new Chameneos().Go(100);

      System.DateTime finish = System.DateTime.Now;
      double time = finish.Subtract( start ).TotalMilliseconds;;

      Console.WriteLine( "elapsed time: " + ( time / 1000 ) );
   }
}
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to