Pascal's triangle: Difference between revisions
m
→Python :: Functional
m (→Functional Python: Tidied) |
|||
Line 4,802:
def finitePascalRows(n):
'''The first n rows of Pascal's triangle.'''
return nextPascal(a)▼
return accumulate(
chain(
),
)
Line 4,839 ⟶ 4,838:
' '
)(' '.join(map(str, ns)))
w = len(' '.join((map(str, ys[-1]))))
return '\n'.join(map(align(w), ys))
Line 4,853:
q = qr[0]
return (q * c) + s + ((q + qr[1]) * c)
return lambda c: lambda s: go(c, s)
Line 4,866 ⟶ 4,867:
yield v
v = f(v)
return go
|