Multiplication tables: Difference between revisions

Content added Content deleted
m (→‎Functional Python: Minor reformat to ease the comparison of list comprehension with list monad)
(→‎Functional Python: Tidying layout for legibility)
Line 4,180: Line 4,180:


xs = enumFromTo(1)(n)
xs = enumFromTo(1)(n)
return unlines(bind(xs)(lambda y: [
return unlines(
pad(str(y) + ':') + unwords(
bind(xs)(lambda y: [
bind(xs)(lambda x: [
pad(str(y) + ':') + unwords(
pad(str(x * y) if x >= y else '')
bind(xs)(lambda x: [
])
pad(str(x * y) if x >= y else '')
)]))
])
)
])
)