
22 Jan
2008
22 Jan
'08
5:08 a.m.
I wrote:
merge' (x:xs) ys = x : merge xs ys
hammingx = 1 : foldr1 merge' [map (h x) hammingx | x <- hammingx]
Sorry. 'foldr1' is still slightly too strict. (Why doesn't the Haskell report define foldr1 in terms of foldr?) The code that works is marge' [] ys = ys merge' (x:xs) ys = x : merge xs ys hammingx = 1 : foldr merge' [] [map (h x) hammingx | x <- hammingx] I had tested that version, but I assumed the foldr1 version would be equivalent.
which actually works.
And I wrote that without testing. Shame on me. Bertram