Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- byteSum :: [Word8] -> [Word8] -> [Word8]
- byteSum = byteSum' 0
- where
- byteSum' 0 [] [] = []
- byteSum' 1 [] [] = [1]
- byteSum' carry (x:xs) (y:ys) =
- let v = x + y + carry
- in v : byteSum' (if v < x || v < y then 1 else 0) xs ys
- main = do
- let bs1 = ...
- let bs2 = ...
- let sum = pack $ byteSum (unpack bs1) (unpack bs2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement