Add test rec_factorial (computes 7!) -- fails
This commit is contained in:
parent
ca790364b6
commit
6f75134474
2 changed files with 10 additions and 0 deletions
1
src/tests/rec_factorial.exp
Normal file
1
src/tests/rec_factorial.exp
Normal file
|
@ -0,0 +1 @@
|
|||
5040
|
9
src/tests/rec_factorial.lambda
Normal file
9
src/tests/rec_factorial.lambda
Normal file
|
@ -0,0 +1,9 @@
|
|||
let rec fact = fun n ->
|
||||
ifzero n then
|
||||
1
|
||||
else
|
||||
let sub_val = fact (n - 1) in
|
||||
n * sub_val
|
||||
in
|
||||
|
||||
print (fact 7)
|
Loading…
Reference in a new issue