Hint 1) fib n = fib (n - 1) + fib (n - 2), with proper base cases
Hint 2) use mapM_ to print a list of pairs, where the list is created by zipping [1..] with the list of fibonacci numbers
On 11 November 2015 at 18:29, Roelof Wobben <r.wobben@home.nl> wrote:
Hello,
I have this exercise :
Define a function
fibTable :: Integer -> String
which produces a table of Fibonacci numbers. For instance, the effect of putStr
(fibTable 6) should be
n fib n
0 0
1 1
2 1
3 2
4 3
5 5
6 8
1) Can somone give me any pointers how to calculate the fibb numbers with list comprehension.
I know that the fib numbers are (n -1) + n
2) Can someone give me any pointers how to write the outcome of every run
Roelof
_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
--
Regards
Sumit Sahrawat
_______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
Geen virus gevonden in dit bericht.
Gecontroleerd door AVG - www.avg.com
Versie: 2015.0.6176 / Virusdatabase: 4460/10979 - datum van uitgifte: 11/11/15