11 lines
277 B
Text
11 lines
277 B
Text
def triangle( height ) =
|
|
width = max( map(a -> a.toString().length(), pascal(height)) )
|
|
|
|
if 2|width
|
|
width++
|
|
|
|
for n <- 1..height
|
|
print( ' '*((width + 1)\2)*(height - n) )
|
|
println( map(a -> format('%' + width + 'd ', a), pascal(n)).mkString() )
|
|
|
|
triangle( 10 )
|