il Mon, 17 May 2004 13:30:49 +0200, Kristof Bastiaensen <kristof / vleeuwen.org> ha scritto:: >Hi, >I would like to know your opinion about the following idea's. >(It is actually are two RCR's) > >(1)* Enumerable::filter and Enumerable::enum_filter > >filter([[method = :each], *args, ] block) > yield values for which block returns true > >3.filter(:times, &lambda{ |i| i[0] == 0 }) do |n| > puts "%i is even" % n >end >=> 2 is even what's wrong with (1..3).select {|x| x[0]==0}.each {|x| p x} ? > >(2)* Enumerable::Enumerator takes a optional block > >powers = 4.enum_for(:times){ |i| i * i } >powers.collect >=> [0, 1, 4, 9] interesting, you should post this on rcrarchive (or maybe more than one)