def cumsum(iter):
    """
    Cumulative sum:
    >>> pydigree.cumsum([0,1,2,3,4])
    [0, 1, 3, 6, 10]
    

    :param iter: the iterable to be cumsum'ed
    
    Returns: cumulative sums
    :rtype: integer
    """
    if not iter:
        return []
    value = 0
    g = [None] * len(iter)
    for idx, x in enumerate(iter):
        value += x
        g[idx] = value
    return g