Add tasks for all the new languages

This commit is contained in:
Tina Müller 2016-12-05 23:44:36 +01:00
parent 9dc3c2bb62
commit bba7bfd280
13208 changed files with 134745 additions and 0 deletions

View file

@ -0,0 +1,5 @@
import lists.zip
def
pascal( 1 ) = [1]
pascal( n ) = [1] + map( (a, b) -> a + b, zip(pascal(n-1), pascal(n-1).tail()) ) + [1]

View file

@ -0,0 +1,3 @@
import integers.choose
def pascal( n ) = [choose( n - 1, k ) | k <- 0..n-1]

View file

@ -0,0 +1,11 @@
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 )