Just another update
This commit is contained in:
parent
a25938f123
commit
00a190b0a6
6591 changed files with 94363 additions and 23227 deletions
9
Task/Fibonacci-sequence/ATS/fibonacci-sequence-2.ats
Normal file
9
Task/Fibonacci-sequence/ATS/fibonacci-sequence-2.ats
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
(*
|
||||
** This one is also referred to as being tail-recursive
|
||||
*)
|
||||
fun
|
||||
fib_trec(n: int): int =
|
||||
if
|
||||
n > 0
|
||||
then (fix loop (i:int, r0:int, r1:int): int => if i > 1 then loop (i-1, r1, r0+r1) else r1)(n, 0, 1)
|
||||
else 0
|
||||
Loading…
Add table
Add a link
Reference in a new issue