Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
9
Task/Fibonacci-sequence/Luck/fibonacci-sequence.luck
Normal file
9
Task/Fibonacci-sequence/Luck/fibonacci-sequence.luck
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
function fib(x: int): int = (
|
||||
let cache = {} in
|
||||
let fibc x = if x<=1 then x else (
|
||||
if x not in cache then
|
||||
cache[x] = fibc(x-1) + fibc(x-2);
|
||||
cache[x]
|
||||
) in fibc(x)
|
||||
);;
|
||||
for x in range(10) do print(fib(x))
|
||||
Loading…
Add table
Add a link
Reference in a new issue