def scanl(col, func=add, acc=None):
'''
Fold a collection from the left using a binary function
and an accumulator into a list of values
'''
if acc is not None:
col = chain([acc], col)
return list(itools.accumulate(col, func))
评论列表
文章目录