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
1
Task/Power-set/FunL/power-set-1.funl
Normal file
1
Task/Power-set/FunL/power-set-1.funl
Normal file
|
|
@ -0,0 +1 @@
|
|||
def powerset( s ) = s.subsets().toSet()
|
||||
5
Task/Power-set/FunL/power-set-2.funl
Normal file
5
Task/Power-set/FunL/power-set-2.funl
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
def
|
||||
powerset( {} ) = {{}}
|
||||
powerset( s ) =
|
||||
acc = powerset( s.tail() )
|
||||
acc + map( x -> {s.head()} + x, acc )
|
||||
5
Task/Power-set/FunL/power-set-3.funl
Normal file
5
Task/Power-set/FunL/power-set-3.funl
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
import lists.foldr
|
||||
|
||||
def powerset( s ) = foldr( \x, acc -> acc + map( a -> {x} + a, acc), {{}}, s )
|
||||
|
||||
println( powerset({1, 2, 3, 4}) )
|
||||
Loading…
Add table
Add a link
Reference in a new issue