[Haskell-cafe] In-place modification
Hugh Perkins
hughperkins at gmail.com
Sun Jul 15 13:08:55 EDT 2007
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 ) );
}
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20070715/13591630/attachment.htm
More information about the Haskell-Cafe
mailing list