recursively sum an array in swift