fib n = loop 0 1 n with loop a b n = if n==0 then a else loop b (a+b) (n-1); end;