by BanazirGalbasi · 11mo ago · 0 comments
Look at the Go homepage. Or Nim. (But not Rust sadly.)
function fib(a)
return countfib(1,1,a)
end
function countfib(a,b,n)
if n == 1 then
return a
else
-- proper tail call
return countfib(b,a+b,n-1)
end
end
print(fib(6)) --> 8