Generating Fibonacci numbers in Haskell?

前端 未结 11 1055
有刺的猬
有刺的猬 2020-11-29 18:35

In Haskell, how can I generate Fibonacci numbers based on the property that the nth Fibonacci number is equal to the (n-2)th Fibonacci number plus the (n-1)th Fibonacci numb

11条回答
  •  星月不相逢
    2020-11-29 19:05

    There are a number of different Haskell algorithms for the Fibonacci sequence here. The "naive" implementation looks like what you're after.

提交回复
热议问题