--Example of recursion and pattern matching in a functional language (Haskell)
addPairs :: [Int] -> [Int]
addPairs [] = []
addPairs [x] = [x]
addPairs (x0:x1:xs) = [x0+x1] ++ addPairs xs
--make union and intersect functions
--union :: [Int] -> [Int] -> [Int]
--intersect :: [Int] -> [Int] -> [Int]
main = do
print (addPairs [1,2,3,4,5,6])
print (addPairs [2,4,6,8,10,11,12])
print (addPairs [1])
print (addPairs [])