Pascal's triangle: Difference between revisions

m
m (→‎Functional Pascal: Updated preamble)
Line 4,150:
def main():
'''Test of two different approaches:
- taking from a non-finite stream of rows,
- or constructing a finite list of rows.'''
print(unlines(map(
showPascal,
[
take(7)(pascalTriangle()), # Non finite,
pascalTriangle() # Non finite,
),
finitePascalRows(7) # finite.
]
Line 4,181 ⟶ 4,183:
def center(n):
'''String s padded with c to approximate centre,
fitting in but not truncated to width n.'''
'''
def go(c, s):
qr = divmod(n - len(s), 2)
9,659

edits