It does not bode well that the first example I looked at (which I chose because it maximally would highlight the benefits of Haskell over other languages):

http://en.literateprograms.org/Sieve_of_Eratosthenes_%28Haskell%29

has the following "Haskell" program.

  primes :: [Int] -> [Int]
  primes :: [] -> []
  primes (n:ns) = n : primes (filter (\v -> v `mod` n /= 0) ns)

Not only are there two conflicting type declarations (making this uncompilable), but after the "obvious" syntactic fix:

primes :: [Int] -> [Int]
primes []     = []
primes (n:ns) = n : primes (filter (\v -> v `mod` n /= 0) ns)

primes (n:ns) gives the wrong answer unless n == 2.

*P> primes [2..47]
[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47]

*P> primes [5..47]
[5,6,7,8,9,11,13,17,19,23,29,31,37,41,43,47]

*P> length . primes $ [100..200]
100

As there are so far relatively few Haskell programs listed (~100), perhaps an interested party might go through and do a sanity check on them.

Dan

Michael T. Richter wrote:
http://en.literateprograms.org/LiteratePrograms:Welcome

There's some Haskell there already, but I think a lot more could be shown there. Even code dumps of things would be nice. They can always be explained later.

--
*Michael T. Richter* <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> (*GoogleTalk:* [EMAIL PROTECTED]) /Never, ever, ever let systems-level engineers do human interaction design unless they have displayed a proven secondary talent in that area. Their opinion of what represents good human-computer interaction tends to be a bit off-track. (Bruce Tognazzini)/


------------------------------------------------------------------------

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to