[Shootout-list] Acceptable implementations?

Einar Karttunen ekarttun@cs.helsinki.fi
Wed, 22 Sep 2004 07:16:04 +0300


On 21.09 17:54, Peter Hinely wrote:
> Is the GHC entry for "sieve" in any way a Sieve of Eratosthenes?
> I don't understand Haskell. It looks like it's using 'mod', which would
> be using hardware division, right?  If so, that's definitely not in the
> spirit of the sieve.
>   http://shootout.alioth.debian.org/lang/ghc/sieve.ghc.html

Well we could argue on the same time that C's entry is invalid
because it uses an array instead of a list. </nitpick>

The haskell solution says in effect:
* the current element is the head of the list
* the rest of the list is the rest of the list with all multiplies of
  the current element removed.

This is imho what the sieve is about. 

- Einar Karttunen