4 ms·
Right; the page https://the-algorithms.com/algorithm/fibonacci-numbers https://the-algorithms.com/algorithm/fibonacci-numbers details a smart algorithm using ma
by tromp 4y ago
Right; the page https://the-algorithms.com/algorithm/fibonacci-numbers https://the-algorithms.com/algorithm/fibonacci-numbers details a smart algorithm using matrix powers and then lists implementations for many languages. But the Haskell implementation is the dumb exponential one rather than the smart one shown.
Btw, another less cryptic way to generate the list of Fibonacci numbers is
fibs = f 0 1 where f a b = a : f b (a+b)