Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
5
Task/Pascals-triangle/FunL/pascals-triangle-1.funl
Normal file
5
Task/Pascals-triangle/FunL/pascals-triangle-1.funl
Normal 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]
|
||||
3
Task/Pascals-triangle/FunL/pascals-triangle-2.funl
Normal file
3
Task/Pascals-triangle/FunL/pascals-triangle-2.funl
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
import integers.choose
|
||||
|
||||
def pascal( n ) = [choose( n - 1, k ) | k <- 0..n-1]
|
||||
11
Task/Pascals-triangle/FunL/pascals-triangle-3.funl
Normal file
11
Task/Pascals-triangle/FunL/pascals-triangle-3.funl
Normal 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 )
|
||||
Loading…
Add table
Add a link
Reference in a new issue