[Haskell-cafe] Stack overflow

Daniel McAllansmith dm.maillists at gmail.com
Thu May 24 16:23:45 EDT 2007


On Friday 25 May 2007 06:50, Grzegorz wrote:
> Hi all,
> I have a simple piece of code which is giving me stack overflow. I guess I
> need to make it stricter sowhere but I can't figure out extactly where. So
> I thought I'd ask the experts.

I'm not sure.  A real expert from the list will probably tell you what the 
cause of the overflow is.

As for finding the mean hamming distance, have you considered something like 
the following:

hammingDistance xs ys = length (filter not (zipWith (==) xs ys))

meanHammingDistance xss yss = sumHDs / cntHDs
    where
        hds = map (uncurry hammingDistance) [(xs, ys) | xs <- xss, ys <- yss]
        sumHDs = fromIntegral (sum hds)
        cntHDs = fromIntegral (length hds)


More information about the Haskell-Cafe mailing list