def sum_rec_halves(x):
    """
    Sums a list using division-in-halves recursion.

    @type  x: iterable
    @param x: the array to sum

    @rtype: int
    @return: the sum of all array values
    """
    n = len(x)
    if n == 0:
        return 0
    if n == 1:
        return x[0]
    # sum of 1st half plus sum of 2nd half
    return sum_rec_halves(x[:n/2]) + sum_rec_halves(x[n/2:])