RosettaCodeData/Task/Fibonacci-sequence/Idris/fibonacci-sequence-3.idris
2016-12-05 23:44:36 +01:00

5 lines
208 B
Text

fibIterative : Nat -> Nat
fibIterative n = fibIterative' n Z (S Z)
where fibIterative' : Nat -> Nat -> Nat -> Nat
fibIterative' Z a _ = a
fibIterative' (S n) a b = fibIterative' n b (a + b)