[Haskell-beginners] assistance please ?

Sumit Sahrawat, Maths & Computing, IIT (BHU) sumit.sahrawat.apm13 at iitbhu.ac.in
Wed Nov 11 13:11:13 UTC 2015


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 at 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 at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>



-- 
Regards

Sumit Sahrawat
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20151111/c94b7358/attachment.html>


More information about the Beginners mailing list