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
4
Task/Factorial/Wart/factorial-1.wart
Normal file
4
Task/Factorial/Wart/factorial-1.wart
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
def (fact n)
|
||||
if (n = 0)
|
||||
1
|
||||
(n * (fact n-1))
|
||||
5
Task/Factorial/Wart/factorial-2.wart
Normal file
5
Task/Factorial/Wart/factorial-2.wart
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
def (fact n)
|
||||
(n * (fact n-1))
|
||||
|
||||
def (fact 0)
|
||||
1
|
||||
4
Task/Factorial/Wart/factorial-3.wart
Normal file
4
Task/Factorial/Wart/factorial-3.wart
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
def (fact n)
|
||||
ret result 1
|
||||
for i 1 (i <= n) ++i
|
||||
result <- result*i
|
||||
7
Task/Factorial/Wart/factorial-4.wart
Normal file
7
Task/Factorial/Wart/factorial-4.wart
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
# a useful helper to generate all the natural numbers until n
|
||||
def (nums n)
|
||||
collect+for i 1 (i <= n) ++i
|
||||
yield i
|
||||
|
||||
def (fact n)
|
||||
(reduce (*) nums.n 1)
|
||||
Loading…
Add table
Add a link
Reference in a new issue