From: Todd Benson Date: 2009-07-14T01:24:57+09:00 Subject: Re: Fibonacci numbers - newbie question. 2009/7/13 Jörg W Mittag : > Todd Benson wrote: >> The first time I saw this problem, I did the recursive thing, but I >> just _had_ to use #inject, so for a full list... >> >> n = 10 >> (0...n-1).inject([0,1]) {|a, i| a.push(a[-2] + a[-1])} > > Although, when it comes to Fibonacci, Haskell just rules, IMHO: > >        fibs = 0 : 1 : zipWith (+) fibs (tail fibs) > > Zipping an infinite list with itself to produce itself ... brilliant. Ha! That is just cool. Todd