Project

General

Profile

Bug #7877

Updated by nobu (Nobuyoshi Nakada) over 5 years ago

=begin 
 So I wanted some real benefit of being lazy.    I wrote a Leibniz formula: 

 ```ruby 
 

   def leibniz(n) 
   
     (0..Float::INFINITY).lazy.with_index {|i, j| (-1 ** j) / (2*i+1).to_f }.take(n).reduce(:+) 
 
   end 
 ``` 

 But it doesn't work (well, it does, indeed. It just doesn't stop working).    I got frustrated. 
 How about it?    Don't you feel it nifty? 

 Of course I can wait for the release next to 2.0.0. 
 =end

Back