[Haskell-cafe] Style

Yitzchak Gale gale at sefer.org
Sun Aug 26 12:53:12 EDT 2007


I wrote:
>> Be careful with types - use Data.List.genericLength
>> here instead of length. Otherwise, tm_silly n is wrong for
>> n >= 13 (on my 32-bit machine) due to round-off error
>> in the Int type.

> Are you sure you really tested tm_silly ?
> length is perfectly enough
> to count the 0 in n! since the number
> of zeros don't go over the Int limit

True, that is not the problem.

Using length forces the result to
be Int, which is different than all of
the other tm's so far. So for example,
try this:

[n | n <- [0..25], tm_silly n /= tm n]

-Yitz


More information about the Haskell-Cafe mailing list