Although this thread were available, I wasn't allowed to ask my question under the answers (due to reputation points) therefore I had to create a new question for that regard. (I am just new in stackoverflow :)
I didn't clearly understand one point regarding how following fibs function works
fibs :: [Integer]
fibs = 1 : 1 : zipWith (+) fibs (tail fibs)
In this stackoverflow thread
nichijou has step by step explained below the thread here I quoted from nichijou:
at first, with fibs and tail fibs, we can get the 3rd:
fibs : [1, 1, ? tail fibs : [1, ? zipWith (+) fibs (tail fibs): [2, ?
now, we know the 3rd is 2, we can get the 4th:
fibs : [1, 1, 2, ? tail fibs : [1, 2, ? zipWith (+) fibs (tail fibs): [2, 3, ?
now the 5th:
fibs : [1, 1, 2, 3, ? tail fibs : [1, 2, 3, ? zipWith (+) fibs (tail fibs): [2, 3, 5, ?
and so on ..
fibs :: [Integer]
fibs = 1 : 1 : zipWith (+) fibs (tail fibs)
Here my question is, after the second step how did we get rid of the duplicates in the list? I was expecting to see the second step should generate a list as
[1, 1, 2, 2, 3]
same goes in the next step and so on...