"murphy" <murphy / cYcnus.de> writes: > what about a more Ruby-like extension: > > class Array > def add > yield self > self > end > end > > # simple > a = [].add do |a| > a << 1 > a << 2 > a << 3 > end > p a > > # Fibonacci > b = [1,1].add do |a| > 15.times { a << a[-1] + a[-2] } > end > p b > > Array#inject may do as well. I think the nice thing about packings is that they don't need to reference the array variable... your code is no improvement to just appending to the array directly, IMHO. -- Christian Neukirchen <chneukirchen / gmail.com> http://chneukirchen.org