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
   where
      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?

Cheers
pepe


_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to