csci2041/repo-zhan4854/Lab_15/examples/fib.src.txt

8 lines
156 B
Text
Raw Permalink Normal View History

2018-01-29 23:35:31 +00:00
function fib(x : int) =
if x < 1 then 1 else fib(x - 1) + fib(x - 2) end;
function fib_array(arr : int[]) =
map(fib, arr);
fib_array([41,42,43,44])