[Haskell-cafe] Space Leak Help

Pepe Iborra mnislaih at gmail.com
Sat Feb 3 14:56:51 EST 2007

hi Dominic

Explicit recursion works just fine for me and keeps things simple:

pad :: [Word8] -> [Word8]
pad xs = pad' xs 0

pad' (x:xs) l = x : pad' xs (succ l)
pad' [] l = [0x80] ++ ps ++ lb
       pl = (64-(l+9)) `mod` 64
       ps = replicate pl 0x00
       lb = i2osp 8 (8*l)

at the cost of (very slightly) hiding data flow.
Seems exactly what you were trying to avoid?


More information about the Haskell-Cafe mailing list