I need to convert a positive binary to a negative binary. My approach seems somehow wrong. Adding an element to the end of a list does not work too. Please help me!
twoComplement :: [Int] -> [Int]
twoComplement (x:xs) | (x:xs) == [] = [x]
| last (x:xs) == 0 = (twoComplement (init (x:xs))) ++ [1]
| last (x:xs) == 1 = (twoComplement (init (x:xs))) ++ [0]
as u see I'm new to haskell.