
4 Feb
2007
4 Feb
'07
4:51 a.m.
On Sun, Feb 04, 2007 at 09:45:12AM +0000, Dominic Steinitz wrote:
pad :: Num a => [a] -> [a] pad = pad' 0 where pad' l [] | l `seq` False = undefined
Stupid typo, that should be: where pad' l _ | l `seq` False = undefined
pad' l [] = [0x80] ++ ps ++ lb where pl = (64-(l+9)) `mod` 64 ps = replicate pl 0x00 lb = i2osp 8 (8*l) pad' l (x:xs) = x : pad' (l+1) xs
The first alternative never succeeds, but to see that the compiler must force the evaluation of 'l'.