Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add x y = strSum '0' (fst (sameLength x y)) (snd (sameLength x y))
- sameLength x y
- | length x < length y = ((resize (length y) x), y)
- | length x > length y = (x, (resize (length x) y))
- | otherwise = (x, y)
- strSum _ "" "" = ""
- strSum c x y = strSum (snd (bitSum c (last x) (last y))) (init x) (init y) ++ [fst (bitSum c (last x) (last y))]
- bitSum '0' '0' '0' = ('0', '0')
- bitSum '0' '1' '0' = ('1', '0')
- bitSum '0' '0' '1' = ('1', '0')
- bitSum '0' '1' '1' = ('0', '1')
- bitSum '1' '0' '0' = ('1', '0')
- bitSum '1' '1' '0' = ('0', '1')
- bitSum '1' '0' '1' = ('0', '1')
- bitSum '1' '1' '1' = ('1', '1')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement